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>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -211,4 +211,7 @@
<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>
</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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

View File

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

View File

@@ -50,6 +50,7 @@ namespace GHelper
buttonStandard.BorderColor = colorStandard;
buttonUltimate.BorderColor = colorTurbo;
buttonOptimized.BorderColor = colorEco;
buttonXGM.BorderColor = colorTurbo;
button60Hz.BorderColor = SystemColors.ActiveBorder;
button120Hz.BorderColor = SystemColors.ActiveBorder;
@@ -112,6 +113,8 @@ namespace GHelper
buttonUltimate.MouseMove += ButtonUltimate_MouseHover;
buttonUltimate.MouseLeave += ButtonGPU_MouseLeave;
buttonXGM.Click += ButtonXGM_Click;
buttonScreenAuto.MouseMove += ButtonScreenAuto_MouseHover;
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)
{
SetBatteryChargeLimit(sliderBattery.Value);
@@ -856,6 +871,7 @@ namespace GHelper
if (this.Visible)
{
InitScreen();
InitXGM();
this.Left = Screen.FromControl(this).WorkingArea.Width - 10 - this.Width;
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()
{
@@ -1202,6 +1229,8 @@ namespace GHelper
ButtonEnabled(buttonStandard, true);
ButtonEnabled(buttonUltimate, true);
InitXGM();
VisualiseGPUMode(GpuMode);
return GpuMode;