Added cycling through aura modes by FN+F4

This commit is contained in:
seerge
2023-02-19 19:40:49 +01:00
parent 2632a1b46d
commit 15112cb5c8
4 changed files with 98 additions and 48 deletions

View File

@@ -429,10 +429,9 @@ public class Aura
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 }; static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
public const int Static = 0; public const int Static = 0;
public const int Breathe = 0; public const int Breathe = 1;
public const int Strobe = 0; public const int Strobe = 2;
public const int Rainbow = 0; public const int Rainbow = 3;
public const int SpeedSlow = 0; public const int SpeedSlow = 0;
public const int SpeedMedium = 1; public const int SpeedMedium = 1;
@@ -559,6 +558,12 @@ namespace GHelper
settingsForm.CyclePerformanceMode(); settingsForm.CyclePerformanceMode();
}); });
return; return;
case 179: // FN+F4
settingsForm.BeginInvoke(delegate
{
settingsForm.CycleAuraMode();
});
return;
case 87: // Battery case 87: // Battery
settingsForm.BeginInvoke(delegate settingsForm.BeginInvoke(delegate
{ {

21
Settings.Designer.cs generated
View File

@@ -61,6 +61,7 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.comboKeyboard = new System.Windows.Forms.ComboBox(); this.comboKeyboard = new System.Windows.Forms.ComboBox();
this.buttonKeyboardColor = new System.Windows.Forms.Button(); this.buttonKeyboardColor = new System.Windows.Forms.Button();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBattery)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).BeginInit();
this.tableGPU.SuspendLayout(); this.tableGPU.SuspendLayout();
@@ -70,6 +71,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).BeginInit();
this.tableScreen.SuspendLayout(); this.tableScreen.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// checkStartup // checkStartup
@@ -482,9 +484,9 @@
"Breathe", "Breathe",
"Strobe", "Strobe",
"Rainbow"}); "Rainbow"});
this.comboKeyboard.Location = new System.Drawing.Point(31, 778); this.comboKeyboard.Location = new System.Drawing.Point(40, 778);
this.comboKeyboard.Name = "comboKeyboard"; this.comboKeyboard.Name = "comboKeyboard";
this.comboKeyboard.Size = new System.Drawing.Size(212, 40); this.comboKeyboard.Size = new System.Drawing.Size(198, 40);
this.comboKeyboard.TabIndex = 24; this.comboKeyboard.TabIndex = 24;
// //
// buttonKeyboardColor // buttonKeyboardColor
@@ -497,11 +499,19 @@
this.buttonKeyboardColor.Location = new System.Drawing.Point(261, 773); this.buttonKeyboardColor.Location = new System.Drawing.Point(261, 773);
this.buttonKeyboardColor.Margin = new System.Windows.Forms.Padding(0); this.buttonKeyboardColor.Margin = new System.Windows.Forms.Padding(0);
this.buttonKeyboardColor.Name = "buttonKeyboardColor"; this.buttonKeyboardColor.Name = "buttonKeyboardColor";
this.buttonKeyboardColor.Size = new System.Drawing.Size(212, 49); this.buttonKeyboardColor.Size = new System.Drawing.Size(212, 50);
this.buttonKeyboardColor.TabIndex = 25; this.buttonKeyboardColor.TabIndex = 25;
this.buttonKeyboardColor.Text = "Color"; this.buttonKeyboardColor.Text = "Color";
this.buttonKeyboardColor.UseVisualStyleBackColor = false; this.buttonKeyboardColor.UseVisualStyleBackColor = false;
this.buttonKeyboardColor.Click += new System.EventHandler(this.buttonKeyboard_Click); //
// pictureBox2
//
this.pictureBox2.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.pictureBox2.Location = new System.Drawing.Point(32, 773);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(212, 50);
this.pictureBox2.TabIndex = 26;
this.pictureBox2.TabStop = false;
// //
// SettingsForm // SettingsForm
// //
@@ -532,6 +542,7 @@
this.Controls.Add(this.labelBattery); this.Controls.Add(this.labelBattery);
this.Controls.Add(this.trackBattery); this.Controls.Add(this.trackBattery);
this.Controls.Add(this.checkStartup); this.Controls.Add(this.checkStartup);
this.Controls.Add(this.pictureBox2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2); this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
this.MaximizeBox = false; this.MaximizeBox = false;
@@ -553,6 +564,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureScreen)).EndInit();
this.tableScreen.ResumeLayout(false); this.tableScreen.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -591,5 +603,6 @@
private Label label1; private Label label1;
private ComboBox comboKeyboard; private ComboBox comboKeyboard;
private Button buttonKeyboardColor; private Button buttonKeyboardColor;
private PictureBox pictureBox2;
} }
} }

View File

@@ -1,4 +1,5 @@
using System.Diagnostics; using Microsoft.VisualBasic.ApplicationServices;
using System.Diagnostics;
using System.Management; using System.Management;
using System.Timers; using System.Timers;
using System.Windows.Forms; using System.Windows.Forms;
@@ -54,43 +55,15 @@ namespace GHelper
checkScreen.CheckedChanged += checkScreen_CheckedChanged; checkScreen.CheckedChanged += checkScreen_CheckedChanged;
comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList; comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList;
comboKeyboard.SelectedIndex = 0;
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged; comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
buttonKeyboardColor.Click += ButtonKeyboardColor_Click;
SetTimer(); SetTimer();
} }
private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
public void InitAura()
{
int mode = Program.config.getConfig("aura_mode");
int color = Program.config.getConfig("aura_color");
int speed = Program.config.getConfig("aura_speed");
if (mode == -1) mode = 0;
if (color == -1) color = Color.FromArgb(255, 255, 255).ToArgb();
Aura.Mode = mode;
Aura.Color1 = Color.FromArgb(color);
comboKeyboard.SelectedIndex = Aura.Mode;
buttonKeyboardColor.FlatAppearance.BorderColor = Aura.Color1;
}
private void ComboKeyboard_SelectedValueChanged(object? sender, EventArgs e)
{
ComboBox cmb = (ComboBox)sender;
int selectedIndex = cmb.SelectedIndex;
Aura.Mode = (byte)selectedIndex;
Aura.ApplyAura();
Program.config.setConfig("aura_mode", selectedIndex);
}
private void buttonKeyboard_Click(object sender, EventArgs e)
{ {
Button but = (Button)sender; Button but = (Button)sender;
@@ -101,13 +74,71 @@ namespace GHelper
if (colorDlg.ShowDialog() == DialogResult.OK) if (colorDlg.ShowDialog() == DialogResult.OK)
{ {
but.FlatAppearance.BorderColor = colorDlg.Color; SetAuraColor(colorDlg.Color);
Aura.Color1 = colorDlg.Color;
Aura.ApplyAura();
Program.config.setConfig("aura_color", colorDlg.Color.ToArgb());
} }
} }
public void InitAura()
{
int mode = Program.config.getConfig("aura_mode");
int colorCode = Program.config.getConfig("aura_color");
int speed = Program.config.getConfig("aura_speed");
Color color = Color.FromArgb(255, 255, 255);
if (mode == -1)
mode = 0;
if (colorCode != -1)
color = Color.FromArgb(colorCode);
SetAuraColor(color, false);
SetAuraMode(mode, false);
Aura.Mode = mode;
}
public void SetAuraColor(Color color, bool apply = true)
{
Aura.Color1 = color;
Program.config.setConfig("aura_color", color.ToArgb());
if (apply)
Aura.ApplyAura();
buttonKeyboardColor.FlatAppearance.BorderColor = color;
}
public void SetAuraMode (int mode = 0, bool apply = true)
{
if (mode > 3) mode = 0;
if (Aura.Mode == mode) return; // same mode
Aura.Mode = mode;
Program.config.setConfig("aura_mode", mode);
if (apply)
Aura.ApplyAura();
comboKeyboard.SelectedIndex = mode;
}
public void CycleAuraMode ()
{
SetAuraMode(Program.config.getConfig("aura_mode") + 1);
}
private void ComboKeyboard_SelectedValueChanged(object? sender, EventArgs e)
{
ComboBox cmb = (ComboBox)sender;
SetAuraMode(cmb.SelectedIndex);
}
private void CheckBoost_Click(object? sender, EventArgs e) private void CheckBoost_Click(object? sender, EventArgs e)
{ {
CheckBox chk = (CheckBox)sender; CheckBox chk = (CheckBox)sender;
@@ -568,6 +599,7 @@ namespace GHelper
Program.config.setConfig("screen_auto", 0); Program.config.setConfig("screen_auto", 0);
} }
} }

View File

@@ -61,7 +61,7 @@
<data name="pictureBattery.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureBattery.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAAY1JREFUaEPtlz1OAzEQhVdIFFyCH0EFDQ1wAhDcgxPACYCOA/BzGTo6aKGKFOAE DAAACwwBP0AiyAAAAY1JREFUaEPtlz1OAzEQhVdIFFyCH0EFDQ1wAhDcgxPACYCOA/BzGTo6aKGKFOAE
0FCABO9FsbSK3uI8J9kFMZ/0FdmMZ+xovLGrIAiCIAiCQLIMr+EL/IRfM5Y1WOsKsvZE7ME3qAq1IWvv 0FCABO9FsbSK3uI8J9kFMZ/0FdmMZ+xovLGrIAiCIAiCQLIMr+EL/IRfM5Y1WOsKsvZE7ME3qAq1IWvv
wiJWYJeTT77CJWjDtlEJu/AS2rAPVbIufII2bWzYceVcbFQix1V4CKe1j2xUEscEN+ANVDGONiqJY505 wiJWYJeTT77CJWjDtlEJu/AS2rAPVbIufII2bWzYceVcbFQix1V4CKe1j2xUEscEN+ANVDGONiqJY505
eATfoYp15N48gFnUYEfFOryDKt7xGWZRA0flhHbgOewNnyWbmIcn8APW412zqEGj8u9+ASY24Rl8GHz6 eATfoYp15N48gFnUYEfFOryDKt7xGWZRA0flhHbgOewNnyWbmIcn8APW412zqEGj8u9+ASY24Rl8GHz6
@@ -74,7 +74,7 @@
<data name="pictureGPU.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureGPU.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAAZVJREFUaEPtmTtOxDAURYcGGtgAsCJo6PisACE2ALTAvvgVsB0KQBRwT2HJGl3y DAAACwwBP0AiyAAAAZVJREFUaEPtmTtOxDAURYcGGtgAsCJo6PisACE2ALTAvvgVsB0KQBRwT2HJGl3y
EtloHPCRjiKNfJ/sOLGV8aLT6XSa4Fa+ya/MD3kjm2dNvsq888l3OQu408szkJwlfQCr5k8NoAVZEV/k EtloHPCRjiKNfJ/sOLGV8aLT6XSa4Fa+ya/MD3kjm2dNvsq888l3OQu408szkJwlfQCr5k8NoAVZEV/k
vhyFK9KKBzLEBVvxWYa4YCuO2ptcsCVDXKim9/JQbst1uSOP5IN07ZcNcaEafspTOcSZpJ3LJ0NcCC8k vhyFK9KKBzLEBVvxWYa4YCuO2ptcsCVDXKim9/JQbst1uSOP5IN07ZcNcaEafspTOcSZpJ3LJ0NcCC8k
d8zB75fS5ZJR5xMMwuWTIS6Em3KILelyeCen8ChdHQxxIeQOD83AlXQ55JmfwrF0dTDEhUrlhZ0CL7ar d8zB75fS5ZJR5xMMwuWTIS6Em3KILelyeCen8ChdHQxxIeQOD83AlXQ55JmfwrF0dTDEhUrlhZ0CL7ar
@@ -87,7 +87,7 @@
<data name="picturePerf.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="picturePerf.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAA31JREFUaEPt2NnrTkEcx/HHmj37hTWJP0BCSe5ESSnklivJUsiuXFiSIlsS98qW DAAACwwBP0AiyAAAA31JREFUaEPt2NnrTkEcx/HHmj37hTWJP0BCSe5ESSnklivJUsiuXFiSIlsS98qW
CLmTP0FKUkqkrNn37f2p39T07fucmfM85/eQzqdexW/mzJlzzpyZeU6jTp06df6L9MQsbMdF3MVrfOui CLmTP0FKUkqkrNn37f2p39T07fucmfM85/eQzqdexW/mzJlzzpyZeU6jTp06df6L9MQsbMdF3MVrfOui
f+tvF7ANM6Fj/nrGYT+e4HdJj7EPY9HxjMBJfIXXuTK+4ASGoyNZjpfwOtOOF1iGbktv6K57J6/Scehc f+tvF7ANM6Fj/nrGYT+e4HdJj7EPY9HxjMBJfIXXuTK+4ASGoyNZjpfwOtOOF1iGbktv6K57J6/Scehc
laY/rsI7YfADt7EReqFHow8GYCJmYzNu4ju8NoIr0Dkrie5GUec/4QDU4dzMh9dWTBdRyZMoGjbnMR5l laY/rsI7YfADt7EReqFHow8GYCJmYzNu4ju8NoIr0Dkrie5GUec/4QDU4dzMh9dWTBdRyZMoGjbnMR5l
@@ -108,7 +108,7 @@
<data name="pictureScreen.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureScreen.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
DwAACw8BkvkDpQAAANBJREFUaEPt2DESAUEUhOF1PQQuxd1wHAGi1U8galU9ktej+qv6M71myyZriYiI DAAACwwBP0AiyAAAANBJREFUaEPt2DESAUEUhOF1PQQuxd1wHAGi1U8galU9ktej+qv6M71myyZriYiI
+Fd7dEFPtDZV311n2KEhdXh2wc4OSHZF7CKdnZGs87H51gPJ2AUckrGxQzI2dkjGxg7J2NghGRs7JGNj +Fd7dEFPtDZV311n2KEhdXh2wc4OSHZF7CKdnZGs87H51gPJ2AUckrGxQzI2dkjGxg7J2NghGRs7JGNj
h2Rs7JCMjR2SsbFDMjZ2SMbGDsnY2CEZGzskY2OHZGzskIyNHZKxsUOy6V8pp3+pr/9h2EU626IhdRN1 h2Rs7JCMjR2SsbFDMjZ2SMbGDsnY2CEZGzskY2OHZGzskIyNHZKxsUOy6V8pp3+pr/9h2EU626IhdRN1
191/bNUZhg8fMeiE7og9h47VWY/obYNuiH3QuTrzR93NtL9ARET8aFleMDJURjd/4/oAAAAASUVORK5C 191/bNUZhg8fMeiE7og9h47VWY/obYNuiH3QuTrzR93NtL9ARET8aFleMDJURjd/4/oAAAAASUVORK5C