XGMobile support

This commit is contained in:
seerge
2023-04-19 17:41:59 +02:00
parent a3a2fdfe14
commit b2ed390bdf
5 changed files with 75 additions and 4 deletions

View File

@@ -330,6 +330,16 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_video_48 {
get {
object obj = ResourceManager.GetObject("icons8_video_48", 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>

View File

@@ -211,4 +211,7 @@
<data name="icons8-help-64" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-help-64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-help-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-help-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8_video_48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

View File

@@ -68,6 +68,7 @@ namespace GHelper
buttonStandard = new RButton(); buttonStandard = new RButton();
buttonOptimized = new RButton(); buttonOptimized = new RButton();
buttonUltimate = new RButton(); buttonUltimate = new RButton();
buttonXGM = new RButton();
panelScreen = new Panel(); panelScreen = new Panel();
labelMidFan = new Label(); labelMidFan = new Label();
labelTipScreen = new Label(); labelTipScreen = new Label();
@@ -534,19 +535,21 @@ namespace GHelper
panelGPU.Location = new Point(10, 210); panelGPU.Location = new Point(10, 210);
panelGPU.Margin = new Padding(8); panelGPU.Margin = new Padding(8);
panelGPU.Name = "panelGPU"; panelGPU.Name = "panelGPU";
panelGPU.Padding = new Padding(0, 0, 0, 10); panelGPU.Padding = new Padding(0, 0, 0, 45);
panelGPU.Size = new Size(810, 237); panelGPU.Size = new Size(810, 237);
panelGPU.TabIndex = 37; panelGPU.TabIndex = 37;
// //
// labelTipGPU // labelTipGPU
// //
labelTipGPU.ForeColor = SystemColors.GrayText; labelTipGPU.ForeColor = SystemColors.GrayText;
labelTipGPU.Location = new Point(24, 191); labelTipGPU.Location = new Point(44, 191);
labelTipGPU.Margin = new Padding(4, 0, 4, 0); labelTipGPU.Margin = new Padding(4, 0, 4, 0);
labelTipGPU.Name = "labelTipGPU"; labelTipGPU.Name = "labelTipGPU";
labelTipGPU.Size = new Size(760, 36); labelTipGPU.Size = new Size(760, 36);
labelTipGPU.TabIndex = 20; labelTipGPU.TabIndex = 20;
labelTipGPU.Text = " "; labelTipGPU.Text = "";
labelTipGPU.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
// //
// pictureGPU // pictureGPU
// //
@@ -593,8 +596,9 @@ namespace GHelper
tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); tableGPU.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
tableGPU.Controls.Add(buttonEco, 0, 0); tableGPU.Controls.Add(buttonEco, 0, 0);
tableGPU.Controls.Add(buttonStandard, 1, 0); tableGPU.Controls.Add(buttonStandard, 1, 0);
tableGPU.Controls.Add(buttonOptimized, 2, 0);
tableGPU.Controls.Add(buttonUltimate, 2, 0); tableGPU.Controls.Add(buttonUltimate, 2, 0);
tableGPU.Controls.Add(buttonXGM, 3, 0);
tableGPU.Controls.Add(buttonOptimized, 3, 0);
tableGPU.Location = new Point(16, 60); tableGPU.Location = new Point(16, 60);
tableGPU.Margin = new Padding(8, 4, 8, 4); tableGPU.Margin = new Padding(8, 4, 8, 4);
tableGPU.Name = "tableGPU"; tableGPU.Name = "tableGPU";
@@ -691,6 +695,30 @@ namespace GHelper
buttonUltimate.Text = Properties.Strings.UltimateMode; buttonUltimate.Text = Properties.Strings.UltimateMode;
buttonUltimate.TextImageRelation = TextImageRelation.ImageAboveText; buttonUltimate.TextImageRelation = TextImageRelation.ImageAboveText;
buttonUltimate.UseVisualStyleBackColor = false; 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 // panelScreen
// //
@@ -1078,6 +1106,7 @@ namespace GHelper
private Label labelGPU; private Label labelGPU;
private Label labelGPUFan; private Label labelGPUFan;
private TableLayoutPanel tableGPU; private TableLayoutPanel tableGPU;
private RButton buttonXGM;
private RButton buttonUltimate; private RButton buttonUltimate;
private RButton buttonStandard; private RButton buttonStandard;
private RButton buttonEco; private RButton buttonEco;

View File

@@ -50,6 +50,7 @@ namespace GHelper
buttonStandard.BorderColor = colorStandard; buttonStandard.BorderColor = colorStandard;
buttonUltimate.BorderColor = colorTurbo; buttonUltimate.BorderColor = colorTurbo;
buttonOptimized.BorderColor = colorEco; buttonOptimized.BorderColor = colorEco;
buttonXGM.BorderColor = colorTurbo;
button60Hz.BorderColor = SystemColors.ActiveBorder; button60Hz.BorderColor = SystemColors.ActiveBorder;
button120Hz.BorderColor = SystemColors.ActiveBorder; button120Hz.BorderColor = SystemColors.ActiveBorder;
@@ -112,6 +113,8 @@ namespace GHelper
buttonUltimate.MouseMove += ButtonUltimate_MouseHover; buttonUltimate.MouseMove += ButtonUltimate_MouseHover;
buttonUltimate.MouseLeave += ButtonGPU_MouseLeave; buttonUltimate.MouseLeave += ButtonGPU_MouseLeave;
buttonXGM.Click += ButtonXGM_Click;
buttonScreenAuto.MouseMove += ButtonScreenAuto_MouseHover; buttonScreenAuto.MouseMove += ButtonScreenAuto_MouseHover;
buttonScreenAuto.MouseLeave += ButtonScreen_MouseLeave; buttonScreenAuto.MouseLeave += ButtonScreen_MouseLeave;
@@ -146,6 +149,18 @@ namespace GHelper
} }
private void ButtonXGM_Click(object? sender, EventArgs e)
{
if (Program.wmi.DeviceGet(ASUSWmi.GPUXG) == 1)
{
Program.wmi.DeviceSet(ASUSWmi.GPUXG, 0, "GPU XGM");
} else
{
Program.wmi.DeviceSet(ASUSWmi.GPUXG, 1, "GPU XGM");
}
InitXGM();
}
private void SliderBattery_ValueChanged(object? sender, EventArgs e) private void SliderBattery_ValueChanged(object? sender, EventArgs e)
{ {
SetBatteryChargeLimit(sliderBattery.Value); SetBatteryChargeLimit(sliderBattery.Value);
@@ -856,6 +871,7 @@ namespace GHelper
if (this.Visible) if (this.Visible)
{ {
InitScreen(); InitScreen();
InitXGM();
this.Left = Screen.FromControl(this).WorkingArea.Width - 10 - this.Width; this.Left = Screen.FromControl(this).WorkingArea.Width - 10 - this.Width;
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height; this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
@@ -1171,6 +1187,17 @@ namespace GHelper
} }
public void InitXGM()
{
int connected = Program.wmi.DeviceGet(ASUSWmi.GPUXGConnected);
int enabled = Program.wmi.DeviceGet(ASUSWmi.GPUXG);
buttonXGM.Visible = (connected == 1);
buttonXGM.Activated = (enabled == 1);
}
public int InitGPUMode() public int InitGPUMode()
{ {
@@ -1202,6 +1229,8 @@ namespace GHelper
ButtonEnabled(buttonStandard, true); ButtonEnabled(buttonStandard, true);
ButtonEnabled(buttonUltimate, true); ButtonEnabled(buttonUltimate, true);
InitXGM();
VisualiseGPUMode(GpuMode); VisualiseGPUMode(GpuMode);
return GpuMode; return GpuMode;