UI tweaks

This commit is contained in:
Serge
2023-05-30 14:55:50 +02:00
parent 9255a8554d
commit 52c2987c88
5 changed files with 185 additions and 95 deletions

View File

@@ -170,8 +170,8 @@ public class AsusACPI
data[0] = BitConverter.GetBytes(eventHandle.ToInt32())[0];
data[1] = BitConverter.GetBytes(eventHandle.ToInt32())[1];
result = Control(0x222400, data, outBuffer);
Logger.WriteLine("ACPI " + result + ":" + BitConverter.ToString(data) + "|" + BitConverter.ToString(outBuffer));
Control(0x222400, data, outBuffer);
Logger.WriteLine("ACPI :" + BitConverter.ToString(data) + "|" + BitConverter.ToString(outBuffer));
while (true)
{
@@ -202,10 +202,11 @@ public class AsusACPI
}
public bool Control(uint dwIoControlCode, byte[] lpInBuffer, byte[] lpOutBuffer)
public void Control(uint dwIoControlCode, byte[] lpInBuffer, byte[] lpOutBuffer)
{
uint lpBytesReturned = 0;
return DeviceIoControl(
DeviceIoControl(
handle,
dwIoControlCode,
lpInBuffer,

View File

@@ -124,6 +124,10 @@ namespace GHelper
_modes.Remove(3);
}
if (AppConfig.ContainsModel("G513")) {
return _modes;
}
if (AppConfig.ContainsModel("Strix") || AppConfig.ContainsModel("Scar"))
{
return _modesStrix;

151
app/Settings.Designer.cs generated
View File

@@ -66,9 +66,9 @@ namespace GHelper
tableGPU = new TableLayoutPanel();
buttonEco = new RButton();
buttonStandard = new RButton();
buttonXGM = new RButton();
buttonOptimized = new RButton();
buttonUltimate = new RButton();
buttonXGM = new RButton();
panelScreen = new Panel();
labelMidFan = new Label();
labelTipScreen = new Label();
@@ -81,12 +81,12 @@ namespace GHelper
labelSreen = new Label();
panelKeyboard = new Panel();
tableLayoutKeyboard = new TableLayoutPanel();
comboKeyboard = new RComboBox();
buttonKeyboard = new RButton();
panelColor = new Panel();
pictureColor2 = new PictureBox();
pictureColor = new PictureBox();
buttonKeyboardColor = new RButton();
buttonKeyboard = new RButton();
comboKeyboard = new RComboBox();
pictureKeyboard = new PictureBox();
labelKeyboard = new Label();
panelMatrix.SuspendLayout();
@@ -121,7 +121,7 @@ namespace GHelper
panelMatrix.Controls.Add(pictureMatrix);
panelMatrix.Controls.Add(labelMatrix);
panelMatrix.Dock = DockStyle.Top;
panelMatrix.Location = new Point(10, 758);
panelMatrix.Location = new Point(10, 795);
panelMatrix.Margin = new Padding(8);
panelMatrix.Name = "panelMatrix";
panelMatrix.Padding = new Padding(0, 0, 0, 12);
@@ -158,7 +158,7 @@ namespace GHelper
tableLayoutMatrix.Name = "tableLayoutMatrix";
tableLayoutMatrix.RowCount = 1;
tableLayoutMatrix.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutMatrix.Size = new Size(771, 60);
tableLayoutMatrix.Size = new Size(771, 59);
tableLayoutMatrix.TabIndex = 43;
//
// comboMatrix
@@ -202,7 +202,7 @@ namespace GHelper
buttonMatrix.Dock = DockStyle.Top;
buttonMatrix.FlatAppearance.BorderSize = 0;
buttonMatrix.FlatStyle = FlatStyle.Flat;
buttonMatrix.Location = new Point(518, 8);
buttonMatrix.Location = new Point(518, 7);
buttonMatrix.Margin = new Padding(4, 7, 4, 7);
buttonMatrix.Name = "buttonMatrix";
buttonMatrix.Secondary = true;
@@ -231,7 +231,7 @@ namespace GHelper
labelMatrix.Name = "labelMatrix";
labelMatrix.Size = new Size(170, 32);
labelMatrix.TabIndex = 38;
labelMatrix.Text = Properties.Strings.AnimeMatrix;
labelMatrix.Text = "Anime Matrix";
//
// panelBattery
//
@@ -244,7 +244,7 @@ namespace GHelper
panelBattery.Controls.Add(pictureBattery);
panelBattery.Controls.Add(labelBatteryTitle);
panelBattery.Dock = DockStyle.Top;
panelBattery.Location = new Point(10, 926);
panelBattery.Location = new Point(10, 963);
panelBattery.Margin = new Padding(8);
panelBattery.Name = "panelBattery";
panelBattery.Padding = new Padding(0, 0, 0, 12);
@@ -276,7 +276,7 @@ namespace GHelper
//
// labelVersion
//
labelVersion.AutoSize = false;
labelVersion.Cursor = Cursors.Hand;
labelVersion.Font = new Font("Segoe UI", 9F, FontStyle.Underline, GraphicsUnit.Point);
labelVersion.ForeColor = SystemColors.ControlDark;
labelVersion.Location = new Point(25, 119);
@@ -285,7 +285,6 @@ namespace GHelper
labelVersion.Size = new Size(300, 32);
labelVersion.TabIndex = 37;
labelVersion.Text = "v.0";
labelVersion.Cursor = Cursors.Hand;
//
// labelBattery
//
@@ -317,7 +316,7 @@ namespace GHelper
labelBatteryTitle.Name = "labelBatteryTitle";
labelBatteryTitle.Size = new Size(393, 36);
labelBatteryTitle.TabIndex = 34;
labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit;
labelBatteryTitle.Text = "Battery Charge Limit";
//
// panelFooter
//
@@ -326,7 +325,7 @@ namespace GHelper
panelFooter.Controls.Add(buttonQuit);
panelFooter.Controls.Add(checkStartup);
panelFooter.Dock = DockStyle.Top;
panelFooter.Location = new Point(10, 1089);
panelFooter.Location = new Point(10, 1126);
panelFooter.Margin = new Padding(8);
panelFooter.Name = "panelFooter";
panelFooter.Padding = new Padding(0, 0, 0, 10);
@@ -398,7 +397,7 @@ namespace GHelper
labelPerf.Name = "labelPerf";
labelPerf.Size = new Size(234, 32);
labelPerf.TabIndex = 31;
labelPerf.Text = Properties.Strings.PerformanceMode;
labelPerf.Text = "Performance Mode";
//
// labelCPUFan
//
@@ -572,7 +571,7 @@ namespace GHelper
labelGPU.Name = "labelGPU";
labelGPU.Size = new Size(136, 32);
labelGPU.TabIndex = 18;
labelGPU.Text = Properties.Strings.GPUMode;
labelGPU.Text = "GPU Mode";
//
// labelGPUFan
//
@@ -653,6 +652,29 @@ namespace GHelper
buttonStandard.TextImageRelation = TextImageRelation.ImageAboveText;
buttonStandard.UseVisualStyleBackColor = false;
//
// buttonXGM
//
buttonXGM.Activated = false;
buttonXGM.BackColor = SystemColors.ControlLightLight;
buttonXGM.BorderColor = Color.Transparent;
buttonXGM.BorderRadius = 5;
buttonXGM.Dock = DockStyle.Top;
buttonXGM.FlatAppearance.BorderSize = 0;
buttonXGM.FlatStyle = FlatStyle.Flat;
buttonXGM.ForeColor = SystemColors.ControlText;
buttonXGM.Image = Properties.Resources.icons8_video_48;
buttonXGM.ImageAlign = ContentAlignment.BottomCenter;
buttonXGM.Location = new Point(4, 132);
buttonXGM.Margin = new Padding(4);
buttonXGM.Name = "buttonXGM";
buttonXGM.Secondary = false;
buttonXGM.Size = new Size(185, 120);
buttonXGM.TabIndex = 2;
buttonXGM.Text = "XG Mobile";
buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText;
buttonXGM.UseVisualStyleBackColor = false;
buttonXGM.Visible = false;
//
// buttonOptimized
//
buttonOptimized.Activated = false;
@@ -696,30 +718,6 @@ namespace GHelper
buttonUltimate.Text = Properties.Strings.UltimateMode;
buttonUltimate.TextImageRelation = TextImageRelation.ImageAboveText;
buttonUltimate.UseVisualStyleBackColor = false;
//
// buttonXGM
//
buttonXGM.Activated = false;
buttonXGM.BackColor = SystemColors.ControlLightLight;
buttonXGM.BorderColor = Color.Transparent;
buttonXGM.BorderRadius = 5;
buttonXGM.Dock = DockStyle.Top;
buttonXGM.FlatAppearance.BorderSize = 0;
buttonXGM.FlatStyle = FlatStyle.Flat;
buttonXGM.ForeColor = SystemColors.ControlText;
buttonXGM.Image = Properties.Resources.icons8_video_48;
buttonXGM.ImageAlign = ContentAlignment.BottomCenter;
buttonXGM.Location = new Point(390, 4);
buttonXGM.Margin = new Padding(4);
buttonXGM.Name = "buttonXGM";
buttonXGM.Secondary = false;
buttonXGM.Size = new Size(185, 120);
buttonXGM.TabIndex = 2;
buttonXGM.Text = "XG Mobile";
buttonXGM.TextImageRelation = TextImageRelation.ImageAboveText;
buttonXGM.UseVisualStyleBackColor = false;
buttonXGM.Visible = false;
//
// panelScreen
//
@@ -731,7 +729,7 @@ namespace GHelper
panelScreen.Controls.Add(pictureScreen);
panelScreen.Controls.Add(labelSreen);
panelScreen.Dock = DockStyle.Top;
panelScreen.Location = new Point(10, 447);
panelScreen.Location = new Point(10, 485);
panelScreen.Margin = new Padding(8);
panelScreen.Name = "panelScreen";
panelScreen.Padding = new Padding(0, 0, 0, 10);
@@ -878,7 +876,7 @@ namespace GHelper
labelSreen.Name = "labelSreen";
labelSreen.Size = new Size(176, 32);
labelSreen.TabIndex = 21;
labelSreen.Text = Properties.Strings.LaptopScreen;
labelSreen.Text = "Laptop Screen";
//
// panelKeyboard
//
@@ -888,11 +886,11 @@ namespace GHelper
panelKeyboard.Controls.Add(pictureKeyboard);
panelKeyboard.Controls.Add(labelKeyboard);
panelKeyboard.Dock = DockStyle.Top;
panelKeyboard.Location = new Point(10, 628);
panelKeyboard.Location = new Point(10, 666);
panelKeyboard.Margin = new Padding(8);
panelKeyboard.Name = "panelKeyboard";
panelKeyboard.Padding = new Padding(0, 0, 0, 12);
panelKeyboard.Size = new Size(810, 130);
panelKeyboard.Size = new Size(810, 129);
panelKeyboard.TabIndex = 39;
//
// tableLayoutKeyboard
@@ -912,25 +910,26 @@ namespace GHelper
tableLayoutKeyboard.Name = "tableLayoutKeyboard";
tableLayoutKeyboard.RowCount = 1;
tableLayoutKeyboard.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
tableLayoutKeyboard.Size = new Size(771, 60);
tableLayoutKeyboard.Size = new Size(771, 59);
tableLayoutKeyboard.TabIndex = 39;
//
// comboKeyboard
// buttonKeyboard
//
comboKeyboard.BorderColor = Color.White;
comboKeyboard.ButtonColor = Color.FromArgb(255, 255, 255);
comboKeyboard.Dock = DockStyle.Top;
comboKeyboard.FlatStyle = FlatStyle.Flat;
comboKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboKeyboard.FormattingEnabled = true;
comboKeyboard.ItemHeight = 32;
comboKeyboard.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
comboKeyboard.Location = new Point(4, 10);
comboKeyboard.Margin = new Padding(4, 10, 4, 8);
comboKeyboard.Name = "comboKeyboard";
comboKeyboard.Size = new Size(249, 44);
comboKeyboard.TabIndex = 35;
comboKeyboard.TabStop = false;
buttonKeyboard.Activated = false;
buttonKeyboard.BackColor = SystemColors.ControlLight;
buttonKeyboard.BorderColor = Color.Transparent;
buttonKeyboard.BorderRadius = 2;
buttonKeyboard.Dock = DockStyle.Top;
buttonKeyboard.FlatAppearance.BorderSize = 0;
buttonKeyboard.FlatStyle = FlatStyle.Flat;
buttonKeyboard.Location = new Point(518, 7);
buttonKeyboard.Margin = new Padding(4, 7, 4, 7);
buttonKeyboard.Name = "buttonKeyboard";
buttonKeyboard.Secondary = true;
buttonKeyboard.Size = new Size(249, 45);
buttonKeyboard.TabIndex = 37;
buttonKeyboard.Text = Properties.Strings.Extra;
buttonKeyboard.UseVisualStyleBackColor = false;
//
// panelColor
//
@@ -939,7 +938,7 @@ namespace GHelper
panelColor.Controls.Add(pictureColor);
panelColor.Controls.Add(buttonKeyboardColor);
panelColor.Dock = DockStyle.Fill;
panelColor.Location = new Point(261, 8);
panelColor.Location = new Point(261, 7);
panelColor.Margin = new Padding(4, 7, 4, 7);
panelColor.Name = "panelColor";
panelColor.Size = new Size(249, 45);
@@ -983,23 +982,22 @@ namespace GHelper
buttonKeyboardColor.Text = Properties.Strings.Color;
buttonKeyboardColor.UseVisualStyleBackColor = false;
//
// buttonKeyboard
// comboKeyboard
//
buttonKeyboard.Activated = false;
buttonKeyboard.BackColor = SystemColors.ControlLight;
buttonKeyboard.BorderColor = Color.Transparent;
buttonKeyboard.BorderRadius = 2;
buttonKeyboard.Dock = DockStyle.Top;
buttonKeyboard.FlatAppearance.BorderSize = 0;
buttonKeyboard.FlatStyle = FlatStyle.Flat;
buttonKeyboard.Location = new Point(518, 8);
buttonKeyboard.Margin = new Padding(4, 7, 4, 7);
buttonKeyboard.Name = "buttonKeyboard";
buttonKeyboard.Secondary = true;
buttonKeyboard.Size = new Size(249, 45);
buttonKeyboard.TabIndex = 37;
buttonKeyboard.Text = Properties.Strings.Extra;
buttonKeyboard.UseVisualStyleBackColor = false;
comboKeyboard.BorderColor = Color.White;
comboKeyboard.ButtonColor = Color.FromArgb(255, 255, 255);
comboKeyboard.Dock = DockStyle.Top;
comboKeyboard.FlatStyle = FlatStyle.Flat;
comboKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
comboKeyboard.FormattingEnabled = true;
comboKeyboard.ItemHeight = 32;
comboKeyboard.Items.AddRange(new object[] { "Static", "Breathe", "Rainbow", "Strobe" });
comboKeyboard.Location = new Point(4, 10);
comboKeyboard.Margin = new Padding(4, 10, 4, 8);
comboKeyboard.Name = "comboKeyboard";
comboKeyboard.Size = new Size(249, 40);
comboKeyboard.TabIndex = 35;
comboKeyboard.TabStop = false;
//
// pictureKeyboard
//
@@ -1021,7 +1019,7 @@ namespace GHelper
labelKeyboard.Name = "labelKeyboard";
labelKeyboard.Size = new Size(210, 32);
labelKeyboard.TabIndex = 32;
labelKeyboard.Text = Properties.Strings.LaptopKeyboard;
labelKeyboard.Text = "Laptop Keyboard";
//
// SettingsForm
//
@@ -1053,7 +1051,6 @@ namespace GHelper
tableLayoutMatrix.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureMatrix).EndInit();
panelBattery.ResumeLayout(false);
panelBattery.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBattery).EndInit();
panelFooter.ResumeLayout(false);
panelFooter.PerformLayout();

View File

@@ -41,6 +41,36 @@ namespace GHelper
InitializeComponent();
InitTheme(true);
buttonSilent.Text = Properties.Strings.Silent;
buttonBalanced.Text = Properties.Strings.Balanced;
buttonTurbo.Text = Properties.Strings.Turbo;
buttonFans.Text = Properties.Strings.FansPower;
buttonEco.Text = Properties.Strings.EcoMode;
buttonUltimate.Text = Properties.Strings.UltimateMode;
buttonStandard.Text = Properties.Strings.StandardMode;
buttonOptimized.Text = Properties.Strings.Optimized;
buttonScreenAuto.Text = Properties.Strings.AutoMode;
buttonMiniled.Text = Properties.Strings.ToggleMiniled;
buttonKeyboardColor.Text = Properties.Strings.Color;
buttonKeyboard.Text = Properties.Strings.Extra;
labelPerf.Text = Properties.Strings.PerformanceMode;
labelGPU.Text = Properties.Strings.GPUMode;
labelSreen.Text = Properties.Strings.LaptopScreen;
labelKeyboard.Text = Properties.Strings.LaptopKeyboard;
labelMatrix.Text = Properties.Strings.AnimeMatrix;
labelBatteryTitle.Text = Properties.Strings.BatteryChargeLimit;
checkMatrix.Text = Properties.Strings.TurnOffOnBattery;
checkStartup.Text = Properties.Strings.RunOnStartup;
buttonMatrix.Text = Properties.Strings.PictureGif;
buttonQuit.Text = Properties.Strings.Quit;
FormClosing += SettingsForm_FormClosing;
buttonSilent.BorderColor = colorEco;
@@ -58,7 +88,6 @@ namespace GHelper
buttonScreenAuto.BorderColor = SystemColors.ActiveBorder;
buttonMiniled.BorderColor = colorTurbo;
buttonOptimized.Click += ButtonOptimized_Click;
buttonSilent.Click += ButtonSilent_Click;
buttonBalanced.Click += ButtonBalanced_Click;
buttonTurbo.Click += ButtonTurbo_Click;
@@ -66,6 +95,7 @@ namespace GHelper
buttonEco.Click += ButtonEco_Click;
buttonStandard.Click += ButtonStandard_Click;
buttonUltimate.Click += ButtonUltimate_Click;
buttonOptimized.Click += ButtonOptimized_Click;
VisibleChanged += SettingsForm_VisibleChanged;
@@ -922,21 +952,21 @@ namespace GHelper
HardwareControl.ReadSensors();
if (HardwareControl.cpuTemp > 0)
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C ";
cpuTemp = ": " + Math.Round((decimal)HardwareControl.cpuTemp).ToString() + "°C";
if (HardwareControl.batteryDischarge > 0)
battery = Properties.Strings.Discharging + ": " + Math.Round((decimal)HardwareControl.batteryDischarge, 1).ToString() + "W";
if (HardwareControl.gpuTemp > 0)
{
gpuTemp = $": {HardwareControl.gpuTemp}°C ";
gpuTemp = $": {HardwareControl.gpuTemp}°C";
}
Program.settingsForm.BeginInvoke(delegate
{
labelCPUFan.Text = "CPU" + cpuTemp + HardwareControl.cpuFan;
labelGPUFan.Text = "GPU" + gpuTemp + HardwareControl.gpuFan;
labelCPUFan.Text = "CPU" + cpuTemp + " " + HardwareControl.cpuFan;
labelGPUFan.Text = "GPU" + gpuTemp + " " + HardwareControl.gpuFan;
if (HardwareControl.midFan is not null)
labelMidFan.Text = "Mid" + HardwareControl.midFan;
@@ -1505,7 +1535,7 @@ namespace GHelper
protected static void KillGPUApps()
{
string[] tokill = { "EADesktop", "RadeonSoftware", "epicgameslauncher" };
string[] tokill = { "EADesktop", "RadeonSoftware", "epicgameslauncher", "nvdisplay.container", "nvcontainer", "nvcplui" };
foreach (string kill in tokill)
foreach (var process in Process.GetProcessesByName(kill)) process.Kill();
@@ -1531,19 +1561,17 @@ namespace GHelper
Task.Run(async () =>
{
int status;
int status = 1;
if (eco == 1) KillGPUApps();
//if (eco == 1) status = 0; else
Logger.WriteLine($"Running eco command {eco}");
status = Program.acpi.SetGPUEco(eco);
if (status == 0 && eco == 1 && hardWay)
{
RestartGPU();
}
if (status == 0 && eco == 1 && hardWay) RestartGPU();
await Task.Delay(TimeSpan.FromMilliseconds(500));
await Task.Delay(TimeSpan.FromMilliseconds(100));
Program.settingsForm.BeginInvoke(delegate
{
InitGPUMode();

View File

@@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">