mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Binding UI
This commit is contained in:
@@ -321,7 +321,7 @@ public static class AppConfig
|
|||||||
|
|
||||||
public static bool IsAlly()
|
public static bool IsAlly()
|
||||||
{
|
{
|
||||||
return ContainsModel("RC71");
|
return true || ContainsModel("RC71");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool NoMKeys()
|
public static bool NoMKeys()
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
ScreenControl screenControl = new ScreenControl();
|
ScreenControl screenControl = new ScreenControl();
|
||||||
ModeControl modeControl = new ModeControl();
|
|
||||||
ClamshellModeControl clamshellControl = new ClamshellModeControl();
|
ClamshellModeControl clamshellControl = new ClamshellModeControl();
|
||||||
|
|
||||||
const string EMPTY = "--------------";
|
const string EMPTY = "--------------";
|
||||||
|
|||||||
1234
app/Handheld.Designer.cs
generated
1234
app/Handheld.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
131
app/Handheld.cs
131
app/Handheld.cs
@@ -6,6 +6,9 @@ namespace GHelper
|
|||||||
public partial class Handheld : RForm
|
public partial class Handheld : RForm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static string activeBinding = "";
|
||||||
|
static RButton? activeButton;
|
||||||
|
|
||||||
public Handheld()
|
public Handheld()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -41,80 +44,120 @@ namespace GHelper
|
|||||||
|
|
||||||
trackVibra.ValueChanged += Controller_Complete;
|
trackVibra.ValueChanged += Controller_Complete;
|
||||||
|
|
||||||
FillBinding("m1", "M1");
|
ButtonBinding("m1", "M1", buttonM1);
|
||||||
FillBinding("m2", "M2");
|
ButtonBinding("m2", "M2", buttonM2);
|
||||||
|
|
||||||
FillBinding("a", "A");
|
ButtonBinding("a", "A", buttonA);
|
||||||
FillBinding("b", "B");
|
ButtonBinding("b", "B", buttonB);
|
||||||
FillBinding("x", "X");
|
ButtonBinding("x", "X", buttonX);
|
||||||
FillBinding("y", "Y");
|
ButtonBinding("y", "Y", buttonY);
|
||||||
|
|
||||||
FillBinding("du", "DPadUp");
|
ButtonBinding("du", "DPad Up", buttonDPU);
|
||||||
FillBinding("dd", "DPadDown");
|
ButtonBinding("dd", "DPad Down", buttonDPD);
|
||||||
|
|
||||||
FillBinding("dl", "DPadLeft");
|
ButtonBinding("dl", "DPad Left", buttonDPL);
|
||||||
FillBinding("dr", "DPadRight");
|
ButtonBinding("dr", "DPad Right", buttonDPR);
|
||||||
|
|
||||||
FillBinding("rb", "RBumper");
|
ButtonBinding("rt", "Right Trigger", buttonRT);
|
||||||
FillBinding("lb", "LBumper");
|
ButtonBinding("lt", "Left Trigger", buttonLT);
|
||||||
|
|
||||||
FillBinding("rs", "RStick");
|
ButtonBinding("rb", "Right Bumper", buttonRB);
|
||||||
FillBinding("ll", "LStick");
|
ButtonBinding("lb", "Left Bumper", buttonLB);
|
||||||
|
|
||||||
|
ButtonBinding("rs", "Right Stick", buttonRS);
|
||||||
|
ButtonBinding("ll", "Left Stick", buttonLS);
|
||||||
|
|
||||||
|
ButtonBinding("vb", "View", buttonView);
|
||||||
|
ButtonBinding("mb", "Menu", buttonMenu);
|
||||||
|
|
||||||
|
ComboBinding(comboPrimary);
|
||||||
|
ComboBinding(comboSecondary);
|
||||||
|
|
||||||
FillBinding("vb", "View");
|
|
||||||
FillBinding("mb", "Menu");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private RComboBox ComboBinding(string name, string value)
|
private void ComboBinding(RComboBox combo)
|
||||||
{
|
{
|
||||||
var combo = new RComboBox();
|
|
||||||
combo.BorderColor = Color.White;
|
|
||||||
combo.ButtonColor = Color.FromArgb(255, 255, 255);
|
|
||||||
combo.Dock = DockStyle.Fill;
|
|
||||||
combo.Name = name;
|
|
||||||
combo.Margin = new Padding(5, 5, 5, 5);
|
|
||||||
|
|
||||||
combo.DropDownStyle = ComboBoxStyle.DropDownList;
|
combo.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
combo.DisplayMember = "Value";
|
combo.DisplayMember = "Value";
|
||||||
combo.ValueMember = "Key";
|
combo.ValueMember = "Key";
|
||||||
foreach (var item in AllyControl.BindCodes)
|
foreach (var item in AllyControl.BindCodes)
|
||||||
{
|
|
||||||
combo.Items.Add(new KeyValuePair<string, string>(item.Key, item.Value));
|
combo.Items.Add(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||||
if (item.Key == value) combo.SelectedItem = item;
|
|
||||||
}
|
|
||||||
combo.SelectedValueChanged += Binding_SelectedValueChanged;
|
combo.SelectedValueChanged += Binding_SelectedValueChanged;
|
||||||
|
|
||||||
return combo;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void FillBinding(string binding, string label)
|
|
||||||
{
|
|
||||||
tableBindings.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
|
||||||
tableBindings.Controls.Add(new Label { Text = label, Anchor = AnchorStyles.Left, Dock = DockStyle.Fill, Padding = new Padding(5, 5, 5, 5) }, 0, tableBindings.RowCount);
|
|
||||||
|
|
||||||
tableBindings.Controls.Add(ComboBinding("bind_" + binding, AppConfig.GetString("bind_" + binding, "")), 1, tableBindings.RowCount);
|
|
||||||
tableBindings.Controls.Add(ComboBinding("bind2_" + binding, AppConfig.GetString("bind2_" + binding, "")), 2, tableBindings.RowCount);
|
|
||||||
|
|
||||||
tableBindings.RowCount++;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Binding_SelectedValueChanged(object? sender, EventArgs e)
|
private void Binding_SelectedValueChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (sender is null) return;
|
if (sender is null) return;
|
||||||
RComboBox combo = (RComboBox)sender;
|
RComboBox combo = (RComboBox)sender;
|
||||||
|
|
||||||
string value = ((KeyValuePair<string, string>)combo.SelectedItem).Key;
|
string value = ((KeyValuePair<string, string>)combo.SelectedItem).Key;
|
||||||
|
string binding = "bind" + (combo.Name == "comboPrimary" ? "" : "2") + "_" + activeBinding;
|
||||||
|
|
||||||
if (value != "") AppConfig.Set(combo.Name, value);
|
if (value != "") AppConfig.Set(binding, value);
|
||||||
else AppConfig.Remove(combo.Name);
|
else AppConfig.Remove(binding);
|
||||||
|
|
||||||
|
VisualiseButton(activeButton, activeBinding);
|
||||||
|
|
||||||
AllyControl.ApplyMode();
|
AllyControl.ApplyMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetComboValue(RComboBox combo, string value)
|
||||||
|
{
|
||||||
|
foreach (var item in AllyControl.BindCodes)
|
||||||
|
if (item.Key == value)
|
||||||
|
{
|
||||||
|
combo.SelectedItem = item;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
combo.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VisualiseButton(RButton button, string binding)
|
||||||
|
{
|
||||||
|
if (button == null) return;
|
||||||
|
|
||||||
|
string primary = AppConfig.GetString("bind_" + binding, "");
|
||||||
|
string secondary = AppConfig.GetString("bind2_" + binding, "");
|
||||||
|
|
||||||
|
if (primary != "" || secondary != "")
|
||||||
|
{
|
||||||
|
button.BorderColor = colorStandard;
|
||||||
|
button.Activated = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
button.Activated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonBinding(string binding, string label, RButton button)
|
||||||
|
{
|
||||||
|
button.Click += (sender, EventArgs) => { buttonBinding_Click(sender, EventArgs, binding, label); };
|
||||||
|
VisualiseButton(button, binding);
|
||||||
|
}
|
||||||
|
|
||||||
|
void buttonBinding_Click(object sender, EventArgs e, string binding, string label)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (sender is null) return;
|
||||||
|
RButton button = (RButton)sender;
|
||||||
|
|
||||||
|
labelBinding.Text = "Binding: " + label;
|
||||||
|
activeBinding = binding;
|
||||||
|
|
||||||
|
SetComboValue(comboPrimary, AppConfig.GetString("bind_" + binding, ""));
|
||||||
|
SetComboValue(comboSecondary, AppConfig.GetString("bind2_" + binding, ""));
|
||||||
|
|
||||||
|
panelBinding.Visible = true;
|
||||||
|
activeButton = button;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Controller_Complete(object? sender, EventArgs e)
|
private void Controller_Complete(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AllyControl.SetDeadzones();
|
AllyControl.SetDeadzones();
|
||||||
|
|||||||
@@ -415,6 +415,8 @@ namespace GHelper.Mode
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!RyzenControl.IsRingExsists()) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SetUV(AppConfig.GetMode("cpu_uv", 0));
|
SetUV(AppConfig.GetMode("cpu_uv", 0));
|
||||||
|
|||||||
10
app/Properties/Resources.Designer.cs
generated
10
app/Properties/Resources.Designer.cs
generated
@@ -60,6 +60,16 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ally {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ally", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -130,6 +130,9 @@
|
|||||||
<data name="icons8_microphone_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8_microphone_96" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-microphone-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-microphone-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="icons8-controls-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\icons8-controls-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="icons8_maus_48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8_maus_48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-maus-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-maus-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -319,7 +322,7 @@
|
|||||||
<data name="icons8-charging-battery-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icons8-charging-battery-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icons8-charging-battery-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="icons8-controls-32" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="ally" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icons8-controls-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\ally.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
app/Resources/ally.png
Normal file
BIN
app/Resources/ally.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user