Merge pull request #96 from seerge/new_ui

New UI
This commit is contained in:
Serge
2023-03-18 18:38:35 +01:00
committed by GitHub
29 changed files with 944 additions and 421 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<System.Windows.Forms.ApplicationConfigurationSection> <System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="System" /> <add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection> </System.Windows.Forms.ApplicationConfigurationSection>
<appSettings> <appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" /> <add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />

14
app/Fans.Designer.cs generated
View File

@@ -31,6 +31,7 @@
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
panelFans = new Panel(); panelFans = new Panel();
labelTip = new Label();
labelBoost = new Label(); labelBoost = new Label();
comboBoost = new ComboBox(); comboBoost = new ComboBox();
picturePerf = new PictureBox(); picturePerf = new PictureBox();
@@ -73,6 +74,7 @@
// //
// panelFans // panelFans
// //
panelFans.Controls.Add(labelTip);
panelFans.Controls.Add(labelBoost); panelFans.Controls.Add(labelBoost);
panelFans.Controls.Add(comboBoost); panelFans.Controls.Add(comboBoost);
panelFans.Controls.Add(picturePerf); panelFans.Controls.Add(picturePerf);
@@ -89,6 +91,17 @@
panelFans.Size = new Size(824, 1159); panelFans.Size = new Size(824, 1159);
panelFans.TabIndex = 12; panelFans.TabIndex = 12;
// //
// labelTip
//
labelTip.AutoSize = true;
labelTip.BackColor = SystemColors.ControlLightLight;
labelTip.Location = new Point(245, 13);
labelTip.Name = "labelTip";
labelTip.Padding = new Padding(5);
labelTip.Size = new Size(107, 42);
labelTip.TabIndex = 40;
labelTip.Text = "500,300";
//
// labelBoost // labelBoost
// //
labelBoost.AutoSize = true; labelBoost.AutoSize = true;
@@ -468,5 +481,6 @@
private PictureBox pictureBox1; private PictureBox pictureBox1;
private ComboBox comboBoost; private ComboBox comboBoost;
private Label labelBoost; private Label labelBoost;
private Label labelTip;
} }
} }

View File

@@ -1,5 +1,9 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.Metrics;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.IO;
using System.Windows.Forms.DataVisualization.Charting; using System.Windows.Forms.DataVisualization.Charting;
namespace GHelper namespace GHelper
@@ -11,6 +15,12 @@ namespace GHelper
Series seriesCPU; Series seriesCPU;
Series seriesGPU; Series seriesGPU;
static string ChartPercToRPM(int percentage, string unit = "")
{
if (percentage == 0) return "OFF";
return (1800 + 200 * Math.Floor(percentage * 0.2)).ToString() + unit;
}
void SetChart(Chart chart, int device) void SetChart(Chart chart, int device)
{ {
@@ -41,10 +51,8 @@ namespace GHelper
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F); chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
chart.ChartAreas[0].AxisY.CustomLabels.Add(-2, 2, "OFF"); for (int i = 0; i <= 90; i += 10)
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i));
for (int i = 1; i <= 9; i++)
chart.ChartAreas[0].AxisY.CustomLabels.Add(i * 10 - 2, i * 10 + 2, (1800 + 400 * i).ToString());
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, "RPM"); chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, "RPM");
@@ -77,6 +85,9 @@ namespace GHelper
InitializeComponent(); InitializeComponent();
labelTip.Visible = false;
labelTip.BackColor = Color.Transparent;
FormClosing += Fans_FormClosing; FormClosing += Fans_FormClosing;
seriesCPU = chartCPU.Series.Add("CPU"); seriesCPU = chartCPU.Series.Add("CPU");
@@ -126,7 +137,7 @@ namespace GHelper
{ {
int boost = NativeMethods.GetCPUBoost(); int boost = NativeMethods.GetCPUBoost();
if (boost >= 0) if (boost >= 0)
comboBoost.SelectedIndex = boost; comboBoost.SelectedIndex = Math.Min(boost, comboBoost.Items.Count - 1);
} }
private void ComboBoost_Changed(object? sender, EventArgs e) private void ComboBoost_Changed(object? sender, EventArgs e)
@@ -334,6 +345,7 @@ namespace GHelper
private void ChartCPU_MouseUp(object? sender, MouseEventArgs e) private void ChartCPU_MouseUp(object? sender, MouseEventArgs e)
{ {
curPoint = null; curPoint = null;
labelTip.Visible = false;
} }
private void ChartCPU_MouseMove(object? sender, MouseEventArgs e) private void ChartCPU_MouseMove(object? sender, MouseEventArgs e)
@@ -371,13 +383,18 @@ namespace GHelper
if (dy < 0) dy = 0; if (dy < 0) dy = 0;
if (dy > 100) dy = 100; if (dy > 100) dy = 100;
dymin = (dx - 60) * 1.2; dymin = (dx - 65) * 1.2;
if (dy < dymin) dy = dymin; if (dy < dymin) dy = dymin;
curPoint.XValue = dx; curPoint.XValue = dx;
curPoint.YValues[0] = dy; curPoint.YValues[0] = dy;
labelTip.Visible = true;
labelTip.Text = Math.Round(dx) + "C, " + ChartPercToRPM((int)dy, " RPM");
labelTip.Top = e.Y + ((Control)sender).Top;
labelTip.Left = e.X;
} }
catch catch
{ {

View File

@@ -16,9 +16,15 @@
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.29</AssemblyVersion> <AssemblyVersion>0.31</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="screenshots\**" />
<EmbeddedResource Remove="screenshots\**" />
<None Remove="screenshots\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="Resources\eco.ico" /> <None Remove="Resources\eco.ico" />
<None Remove="Resources\icons8-charging-battery-48.png" /> <None Remove="Resources\icons8-charging-battery-48.png" />
@@ -102,8 +108,4 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="screenshots\" />
</ItemGroup>
</Project> </Project>

67
app/HighDpiHelper.cs Normal file
View File

@@ -0,0 +1,67 @@
using System.Drawing.Drawing2D;
public static class HighDpiHelper
{
public static void AdjustControlImagesDpiScale(Control container, float baseScale = 2)
{
var dpiScale = GetDpiScale(container).Value;
AdjustControlImagesDpiScale(container.Controls, dpiScale / baseScale);
}
public static void AdjustButtonDpiScale(ButtonBase button, float dpiScale)
{
var image = button.Image;
if (image == null)
return;
button.Image = ScaleImage(image, dpiScale);
}
private static void AdjustControlImagesDpiScale(Control.ControlCollection controls, float dpiScale)
{
foreach (Control control in controls)
{
var button = control as ButtonBase;
if (button != null)
AdjustButtonDpiScale(button, dpiScale);
AdjustControlImagesDpiScale(control.Controls, dpiScale);
}
}
public static Lazy<float> GetDpiScale(Control control)
{
return new Lazy<float>(() =>
{
using (var graphics = control.CreateGraphics())
return graphics.DpiX / 96.0f;
});
}
private static Image ScaleImage(Image image, float dpiScale)
{
var newSize = ScaleSize(image.Size, dpiScale);
var newBitmap = new Bitmap(newSize.Width, newSize.Height);
using (var g = Graphics.FromImage(newBitmap))
{
// According to this blog post http://blogs.msdn.com/b/visualstudio/archive/2014/03/19/improving-high-dpi-support-for-visual-studio-2013.aspx
// NearestNeighbor is more adapted for 200% and 200%+ DPI
var interpolationMode = InterpolationMode.HighQualityBicubic;
if (dpiScale >= 2.0f)
interpolationMode = InterpolationMode.NearestNeighbor;
g.InterpolationMode = interpolationMode;
g.DrawImage(image, new Rectangle(new Point(), newSize));
}
return newBitmap;
}
private static Size ScaleSize(Size size, float scale)
{
return new Size((int)(size.Width * scale), (int)(size.Height * scale));
}
}

View File

@@ -60,8 +60,6 @@ namespace GHelper
settingsForm.InitAura(); settingsForm.InitAura();
settingsForm.InitMatrix(); settingsForm.InitMatrix();
settingsForm.VisualiseGPUAuto(config.getConfig("gpu_auto"));
settingsForm.VisualiseScreenAuto(config.getConfig("screen_auto"));
settingsForm.SetStartupCheck(Startup.IsScheduled()); settingsForm.SetStartupCheck(Startup.IsScheduled());
SetAutoModes(); SetAutoModes();

View File

@@ -80,6 +80,26 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_balance_symbol_96 {
get {
object obj = ResourceManager.GetObject("icons8-balance-symbol-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_bicycle_48__1_ {
get {
object obj = ResourceManager.GetObject("icons8-bicycle-48 (1)", 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>
@@ -90,6 +110,16 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_fan_48 {
get {
object obj = ResourceManager.GetObject("icons8-fan-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>
@@ -100,6 +130,36 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_fan_speed_48 {
get {
object obj = ResourceManager.GetObject("icons8-fan-speed-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_fiat_500_48 {
get {
object obj = ResourceManager.GetObject("icons8-fiat-500-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_game_controller_48 {
get {
object obj = ResourceManager.GetObject("icons8-game-controller-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>
@@ -120,6 +180,36 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_launch_96 {
get {
object obj = ResourceManager.GetObject("icons8-launch-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_leaf_48 {
get {
object obj = ResourceManager.GetObject("icons8-leaf-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_leaf_96 {
get {
object obj = ResourceManager.GetObject("icons8-leaf-96", 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 +220,26 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_organic_food_96 {
get {
object obj = ResourceManager.GetObject("icons8-organic-food-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_organic_food_961 {
get {
object obj = ResourceManager.GetObject("icons8-organic-food-961", 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>
@@ -140,6 +250,56 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_project_management_48 {
get {
object obj = ResourceManager.GetObject("icons8-project-management-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_project_management_48__1_ {
get {
object obj = ResourceManager.GetObject("icons8-project-management-48 (1)", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_rocket_48 {
get {
object obj = ResourceManager.GetObject("icons8-rocket-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_spa_flower_48 {
get {
object obj = ResourceManager.GetObject("icons8-spa-flower-48", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_spa_flower_96 {
get {
object obj = ResourceManager.GetObject("icons8-spa-flower-96", 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>
@@ -170,6 +330,16 @@ namespace GHelper.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_xbox_controller_96 {
get {
object obj = ResourceManager.GetObject("icons8-xbox-controller-96", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary> /// </summary>

View File

@@ -118,43 +118,94 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-leaf-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-leaf-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-matrix-desktop-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-launch-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-matrix-desktop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-launch-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-organic-food-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-organic-food-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fiat-500-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fiat-500-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-project-management-48 (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-project-management-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-bicycle-48 (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-bicycle-48 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-head-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-head-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-processor-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-processor-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-spa-flower-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-spa-flower-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-spa-flower-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-spa-flower-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-keyboard-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-keyboard-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-keyboard-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-fan-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="eco" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\eco.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-rocket-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-rocket-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-organic-food-961" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-organic-food-961.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-balance-symbol-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-balance-symbol-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-matrix-desktop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-matrix-desktop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-xbox-controller-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-xbox-controller-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-project-management-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-project-management-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-leaf-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-leaf-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ultimate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ultimate.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="standard" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\standard.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-speed-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-speed-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="everything-is-fine-itsfine" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="everything-is-fine-itsfine" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\everything-is-fine-itsfine.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\everything-is-fine-itsfine.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="icons8-speed-96" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="icons8-game-controller-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\icons8-game-controller-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-video-card-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-video-card-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-fan-head-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-fan-head-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-charging-battery-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-charging-battery-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-laptop-48.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-processor-96" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-processor-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 763 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

View File

@@ -1,4 +1,5 @@
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
namespace CustomControls namespace CustomControls
@@ -29,9 +30,11 @@ namespace CustomControls
if (activated != value) if (activated != value)
this.Invalidate(); this.Invalidate();
activated = value; activated = value;
} }
} }
public RoundedButton() public RoundedButton()
{ {
this.FlatStyle = FlatStyle.Flat; this.FlatStyle = FlatStyle.Flat;
@@ -52,19 +55,23 @@ namespace CustomControls
return path; return path;
} }
protected override void OnPaint(PaintEventArgs pevent) protected override void OnPaint(PaintEventArgs pevent)
{ {
base.OnPaint(pevent); base.OnPaint(pevent);
float ratio = pevent.Graphics.DpiX / 192.0f;
int border = (int)(ratio * borderSize);
Rectangle rectSurface = this.ClientRectangle; Rectangle rectSurface = this.ClientRectangle;
Rectangle rectBorder = Rectangle.Inflate(rectSurface, -borderSize, -borderSize); Rectangle rectBorder = Rectangle.Inflate(rectSurface, -border, -border);
Color borderDrawColor = activated ? borderColor : Color.Transparent; Color borderDrawColor = activated ? borderColor : Color.Transparent;
using (GraphicsPath pathSurface = GetFigurePath(rectSurface, borderRadius+borderSize)) using (GraphicsPath pathSurface = GetFigurePath(rectSurface, borderRadius+ border))
using (GraphicsPath pathBorder = GetFigurePath(rectBorder, borderRadius)) using (GraphicsPath pathBorder = GetFigurePath(rectBorder, borderRadius))
using (Pen penSurface = new Pen(this.Parent.BackColor, borderSize)) using (Pen penSurface = new Pen(this.Parent.BackColor, border))
using (Pen penBorder = new Pen(borderDrawColor, borderSize)) using (Pen penBorder = new Pen(borderDrawColor, border))
{ {
penBorder.Alignment = PenAlignment.Outset; penBorder.Alignment = PenAlignment.Outset;
pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias; pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

720
app/Settings.Designer.cs generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,6 @@ using System.Diagnostics;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Timers; using System.Timers;
namespace GHelper namespace GHelper
{ {
@@ -28,9 +27,10 @@ namespace GHelper
public SettingsForm() public SettingsForm()
{ {
InitializeComponent(); InitializeComponent();
HighDpiHelper.AdjustControlImagesDpiScale(this, 2);
FormClosing += SettingsForm_FormClosing; FormClosing += SettingsForm_FormClosing;
buttonSilent.BorderColor = colorEco; buttonSilent.BorderColor = colorEco;
@@ -40,10 +40,13 @@ namespace GHelper
buttonEco.BorderColor = colorEco; buttonEco.BorderColor = colorEco;
buttonStandard.BorderColor = colorStandard; buttonStandard.BorderColor = colorStandard;
buttonUltimate.BorderColor = colorTurbo; buttonUltimate.BorderColor = colorTurbo;
buttonOptimized.BorderColor = colorEco;
button60Hz.BorderColor = SystemColors.ActiveBorder; button60Hz.BorderColor = SystemColors.ActiveBorder;
button120Hz.BorderColor = SystemColors.ActiveBorder; button120Hz.BorderColor = SystemColors.ActiveBorder;
buttonScreenAuto.BorderColor = SystemColors.ActiveBorder;
buttonOptimized.Click += ButtonOptimized_Click;
buttonSilent.Click += ButtonSilent_Click; buttonSilent.Click += ButtonSilent_Click;
buttonBalanced.Click += ButtonBalanced_Click; buttonBalanced.Click += ButtonBalanced_Click;
buttonTurbo.Click += ButtonTurbo_Click; buttonTurbo.Click += ButtonTurbo_Click;
@@ -58,13 +61,10 @@ namespace GHelper
button60Hz.Click += Button60Hz_Click; button60Hz.Click += Button60Hz_Click;
button120Hz.Click += Button120Hz_Click; button120Hz.Click += Button120Hz_Click;
buttonScreenAuto.Click += ButtonScreenAuto_Click;
buttonQuit.Click += ButtonQuit_Click; buttonQuit.Click += ButtonQuit_Click;
checkGPU.CheckedChanged += CheckGPU_CheckedChanged;
checkScreen.CheckedChanged += checkScreen_CheckedChanged;
comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList; comboKeyboard.DropDownStyle = ComboBoxStyle.DropDownList;
comboKeyboard.SelectedIndex = 0; comboKeyboard.SelectedIndex = 0;
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged; comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
@@ -94,10 +94,92 @@ namespace GHelper
labelVersion.Click += LabelVersion_Click; labelVersion.Click += LabelVersion_Click;
buttonOptimized.MouseMove += ButtonOptimized_MouseHover;
buttonOptimized.MouseLeave += ButtonGPU_MouseLeave;
buttonEco.MouseMove += ButtonEco_MouseHover;
buttonEco.MouseLeave += ButtonGPU_MouseLeave;
buttonStandard.MouseMove += ButtonStandard_MouseHover;
buttonStandard.MouseLeave += ButtonGPU_MouseLeave;
buttonUltimate.MouseMove += ButtonUltimate_MouseHover;
buttonUltimate.MouseLeave += ButtonGPU_MouseLeave;
buttonScreenAuto.MouseMove += ButtonScreenAuto_MouseHover;
buttonScreenAuto.MouseLeave += ButtonScreen_MouseLeave;
button60Hz.MouseMove += Button60Hz_MouseHover;
button60Hz.MouseLeave += ButtonScreen_MouseLeave;
button120Hz.MouseMove += Button120Hz_MouseHover;
button120Hz.MouseLeave += ButtonScreen_MouseLeave;
//buttonStandard.Image = (Image)(new Bitmap(buttonStandard.Image, new Size(16, 16)));
SetTimer(); SetTimer();
} }
private void Button120Hz_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = "Max refresh rate + screen overdrive for lower latency";
}
private void Button60Hz_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = "60Hz refresh rate to save battery";
}
private void ButtonScreen_MouseLeave(object? sender, EventArgs e)
{
labelTipScreen.Text = "";
}
private void ButtonScreenAuto_MouseHover(object? sender, EventArgs e)
{
labelTipScreen.Text = "Sets 60Hz to save battery, and back when plugged";
}
private void ButtonUltimate_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Routes laptop screen to dGPU, maximizing FPS";
}
private void ButtonStandard_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Enables dGPU for standard use";
}
private void ButtonEco_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Disables dGPU for battery savings";
}
private void ButtonOptimized_MouseHover(object? sender, EventArgs e)
{
labelTipGPU.Text = "Switch to Eco on battery and to Standard when plugged";
}
private void ButtonGPU_MouseLeave(object? sender, EventArgs e)
{
labelTipGPU.Text = "";
}
private void ButtonOptimized_Click(object? sender, EventArgs e)
{
Program.config.setConfig("gpu_auto", (Program.config.getConfig("gpu_auto") == 1) ? 0 : 1);
VisualiseGPUMode();
AutoGPUMode(SystemInformation.PowerStatus.PowerLineStatus);
}
private void ButtonScreenAuto_Click(object? sender, EventArgs e)
{
Program.config.setConfig("screen_auto", 1);
InitScreen();
AutoScreen(SystemInformation.PowerStatus.PowerLineStatus);
}
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
{ {
@@ -130,12 +212,6 @@ namespace GHelper
base.WndProc(ref m); base.WndProc(ref m);
} }
private void CheckGPU_CheckedChanged(object? sender, EventArgs e)
{
if (sender is null) return;
CheckBox check = (CheckBox)sender;
Program.config.setConfig("gpu_auto", check.Checked ? 1 : 0);
}
public void SetVersionLabel(string label, string url = null) public void SetVersionLabel(string label, string url = null)
{ {
@@ -528,11 +604,13 @@ namespace GHelper
private void Button120Hz_Click(object? sender, EventArgs e) private void Button120Hz_Click(object? sender, EventArgs e)
{ {
Program.config.setConfig("screen_auto", 0);
SetScreen(1000, 1); SetScreen(1000, 1);
} }
private void Button60Hz_Click(object? sender, EventArgs e) private void Button60Hz_Click(object? sender, EventArgs e)
{ {
Program.config.setConfig("screen_auto", 0);
SetScreen(60, 0); SetScreen(60, 0);
} }
@@ -558,10 +636,11 @@ namespace GHelper
if (frequency <= 0) return; if (frequency <= 0) return;
NativeMethods.SetRefreshRate(frequency); NativeMethods.SetRefreshRate(frequency);
if (overdrive > 0) if (overdrive >= 0)
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive); Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
InitScreen(); InitScreen();
Logger.WriteLine("Screen " + frequency.ToString() + "Hz"); Logger.WriteLine("Screen " + frequency.ToString() + "Hz");
} }
@@ -572,22 +651,7 @@ namespace GHelper
int frequency = NativeMethods.GetRefreshRate(); int frequency = NativeMethods.GetRefreshRate();
int maxFrequency = Program.config.getConfig("max_frequency"); int maxFrequency = Program.config.getConfig("max_frequency");
if (frequency < 0) bool screenAuto = (Program.config.getConfig("screen_auto") == 1);
{
button60Hz.Enabled = false;
button120Hz.Enabled = false;
labelSreen.Text = "Laptop Screen: Turned off";
button60Hz.BackColor = SystemColors.ControlLight;
button120Hz.BackColor = SystemColors.ControlLight;
}
else
{
button60Hz.Enabled = true;
button120Hz.Enabled = true;
button60Hz.BackColor = SystemColors.ControlLightLight;
button120Hz.BackColor = SystemColors.ControlLightLight;
labelSreen.Text = "Laptop Screen";
}
int overdrive = 0; int overdrive = 0;
try try
@@ -599,10 +663,37 @@ namespace GHelper
Logger.WriteLine("Screen Overdrive not supported"); Logger.WriteLine("Screen Overdrive not supported");
} }
if (frequency < 0)
{
button60Hz.Enabled = false;
button120Hz.Enabled = false;
buttonScreenAuto.Enabled = false;
labelSreen.Text = "Laptop Screen: Turned off";
button60Hz.BackColor = SystemColors.ControlLight;
button120Hz.BackColor = SystemColors.ControlLight;
buttonScreenAuto.BackColor = SystemColors.ControlLight;
}
else
{
button60Hz.Enabled = true;
button120Hz.Enabled = true;
buttonScreenAuto.Enabled = true;
button60Hz.BackColor = SystemColors.ControlLightLight;
button120Hz.BackColor = SystemColors.ControlLightLight;
buttonScreenAuto.BackColor = SystemColors.ControlLightLight;
labelSreen.Text = "Laptop Screen: " + frequency + "Hz" + ((overdrive == 1) ? " + Overdrive" : "");
}
button60Hz.Activated = false; button60Hz.Activated = false;
button120Hz.Activated = false; button120Hz.Activated = false;
buttonScreenAuto.Activated = false;
if (frequency == 60) if (screenAuto)
{
buttonScreenAuto.Activated = true;
}
else if (frequency == 60)
{ {
button60Hz.Activated = true; button60Hz.Activated = true;
} }
@@ -857,8 +948,7 @@ namespace GHelper
public void AutoScreen(PowerLineStatus Plugged = PowerLineStatus.Online) public void AutoScreen(PowerLineStatus Plugged = PowerLineStatus.Online)
{ {
int ScreenAuto = Program.config.getConfig("screen_auto"); if (Program.config.getConfig("screen_auto") != 1) return;
if (ScreenAuto != 1) return;
if (Plugged == PowerLineStatus.Online) if (Plugged == PowerLineStatus.Online)
SetScreen(1000, 1); SetScreen(1000, 1);
@@ -871,8 +961,8 @@ namespace GHelper
public bool AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online) public bool AutoGPUMode(PowerLineStatus Plugged = PowerLineStatus.Online)
{ {
int GpuAuto = Program.config.getConfig("gpu_auto"); bool GpuAuto = Program.config.getConfig("gpu_auto") == 1;
if (GpuAuto != 1) return false; if (!GpuAuto) return false;
int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco); int eco = Program.wmi.DeviceGet(ASUSWmi.GPUEco);
int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux); int mux = Program.wmi.DeviceGet(ASUSWmi.GPUMux);
@@ -897,6 +987,29 @@ namespace GHelper
} }
private void UltimateUI(bool ultimate)
{
if (!ultimate)
{
tableGPU.Controls.Remove(buttonUltimate);
/*
* buttonFans.Image = null;
buttonFans.Height = 44;
*/
tablePerf.ColumnCount = 0;
tableGPU.ColumnCount = 0;
}
tableLayoutKeyboard.ColumnCount = 0;
tableScreen.ColumnCount = 0;
tableLayoutMatrix.ColumnCount = 0;
}
public int InitGPUMode() public int InitGPUMode()
{ {
@@ -914,9 +1027,11 @@ namespace GHelper
else else
GpuMode = ASUSWmi.GPUModeStandard; GpuMode = ASUSWmi.GPUModeStandard;
buttonUltimate.Visible = (mux == 1); UltimateUI(mux == 1);
} }
ButtonEnabled(buttonOptimized, true);
ButtonEnabled(buttonEco, true); ButtonEnabled(buttonEco, true);
ButtonEnabled(buttonStandard, true); ButtonEnabled(buttonStandard, true);
ButtonEnabled(buttonUltimate, true); ButtonEnabled(buttonUltimate, true);
@@ -932,6 +1047,7 @@ namespace GHelper
public void SetEcoGPU(int eco) public void SetEcoGPU(int eco)
{ {
ButtonEnabled(buttonOptimized, false);
ButtonEnabled(buttonEco, false); ButtonEnabled(buttonEco, false);
ButtonEnabled(buttonStandard, false); ButtonEnabled(buttonStandard, false);
ButtonEnabled(buttonUltimate, false); ButtonEnabled(buttonUltimate, false);
@@ -968,9 +1084,13 @@ namespace GHelper
{ {
int CurrentGPU = Program.config.getConfig("gpu_mode"); int CurrentGPU = Program.config.getConfig("gpu_mode");
Program.config.setConfig("gpu_auto", 0);
if (CurrentGPU == GPUMode) if (CurrentGPU == GPUMode)
{
VisualiseGPUMode();
return; return;
}
var restart = false; var restart = false;
var changed = false; var changed = false;
@@ -987,7 +1107,7 @@ namespace GHelper
} }
else if (GPUMode == ASUSWmi.GPUModeUltimate) else if (GPUMode == ASUSWmi.GPUModeUltimate)
{ {
DialogResult dialogResult = MessageBox.Show(" Ultimate Mode requires restart", "Reboot now?", MessageBoxButtons.YesNo); DialogResult dialogResult = MessageBox.Show("Ultimate Mode requires restart", "Reboot now?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes) if (dialogResult == DialogResult.Yes)
{ {
Program.wmi.DeviceSet(ASUSWmi.GPUMux, 0); Program.wmi.DeviceSet(ASUSWmi.GPUMux, 0);
@@ -1012,60 +1132,55 @@ namespace GHelper
if (changed) if (changed)
{ {
Program.config.setConfig("gpu_mode", GPUMode); Program.config.setConfig("gpu_mode", GPUMode);
HardwareMonitor.RecreateGpuTemperatureProviderWithRetry(); HardwareMonitor.RecreateGpuTemperatureProviderWithRetry();
} }
if (restart) if (restart)
{ {
VisualiseGPUMode(GPUMode); VisualiseGPUMode();
Process.Start("shutdown", "/r /t 1"); Process.Start("shutdown", "/r /t 1");
} }
} }
public void VisualiseGPUAuto(int GPUAuto)
{
checkGPU.Checked = (GPUAuto == 1);
}
public void VisualiseScreenAuto(int ScreenAuto)
{
checkScreen.Checked = (ScreenAuto == 1);
}
public void VisualiseGPUMode(int GPUMode = -1) public void VisualiseGPUMode(int GPUMode = -1)
{ {
if (GPUMode == -1) if (GPUMode == -1)
{
GPUMode = Program.config.getConfig("gpu_mode"); GPUMode = Program.config.getConfig("gpu_mode");
}
bool GPUAuto = (Program.config.getConfig("gpu_auto") == 1);
buttonEco.Activated = false; buttonEco.Activated = false;
buttonStandard.Activated = false; buttonStandard.Activated = false;
buttonUltimate.Activated = false; buttonUltimate.Activated = false;
buttonOptimized.Activated = false;
switch (GPUMode) switch (GPUMode)
{ {
case ASUSWmi.GPUModeEco: case ASUSWmi.GPUModeEco:
buttonEco.Activated = true; buttonOptimized.BorderColor = colorEco;
buttonEco.Activated = !GPUAuto;
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = "GPU Mode: iGPU only"; labelGPU.Text = "GPU Mode: iGPU only";
Program.trayIcon.Icon = GHelper.Properties.Resources.eco; Program.trayIcon.Icon = Properties.Resources.eco;
break; break;
case ASUSWmi.GPUModeUltimate: case ASUSWmi.GPUModeUltimate:
buttonUltimate.Activated = true; buttonUltimate.Activated = true;
labelGPU.Text = "GPU Mode: dGPU exclusive"; labelGPU.Text = "GPU Mode: dGPU exclusive";
Program.trayIcon.Icon = GHelper.Properties.Resources.ultimate; Program.trayIcon.Icon = Properties.Resources.ultimate;
break; break;
default: default:
buttonStandard.Activated = true; buttonOptimized.BorderColor = colorStandard;
buttonStandard.Activated = !GPUAuto;
buttonOptimized.Activated = GPUAuto;
labelGPU.Text = "GPU Mode: iGPU + dGPU"; labelGPU.Text = "GPU Mode: iGPU + dGPU";
Program.trayIcon.Icon = GHelper.Properties.Resources.standard; Program.trayIcon.Icon = Properties.Resources.standard;
break; break;
} }
} }
@@ -1123,14 +1238,6 @@ namespace GHelper
} }
private void checkScreen_CheckedChanged(object? sender, EventArgs e)
{
if (sender is null) return;
CheckBox check = (CheckBox)sender;
Program.config.setConfig("screen_auto", check.Checked ? 1 : 0);
}
} }

View File

@@ -54,8 +54,8 @@
<application xmlns="urn:schemas-microsoft-com:asm.v3"> <application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings> <windowsSettings>
<!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>--> <!--<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor/dpiAwareness>-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">System</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings> </windowsSettings>
</application> </application>