mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13ec0f8911 | ||
|
|
fcf213f1a0 | ||
|
|
c73b4fce97 | ||
|
|
aab1e08729 | ||
|
|
cf3a84aa3d | ||
|
|
8d119b386d | ||
|
|
0605e63433 |
@@ -21,6 +21,8 @@ public class ASUSWmi
|
|||||||
public const uint PerformanceMode = 0x00120075; // Thermal Control
|
public const uint PerformanceMode = 0x00120075; // Thermal Control
|
||||||
|
|
||||||
public const uint GPUEco = 0x00090020;
|
public const uint GPUEco = 0x00090020;
|
||||||
|
public const uint GPUXGConnected = 0x00090018;
|
||||||
|
public const uint GPUXG = 0x00090019;
|
||||||
public const uint GPUMux = 0x00090016;
|
public const uint GPUMux = 0x00090016;
|
||||||
|
|
||||||
public const uint BatteryLimit = 0x00120057;
|
public const uint BatteryLimit = 0x00120057;
|
||||||
@@ -58,7 +60,7 @@ public class ASUSWmi
|
|||||||
public const int GPUModeUltimate = 2;
|
public const int GPUModeUltimate = 2;
|
||||||
|
|
||||||
|
|
||||||
public const int MaxTotal = 150;
|
public const int MaxTotal = 180;
|
||||||
public const int MinTotal = 5;
|
public const int MinTotal = 5;
|
||||||
public const int DefaultTotal = 125;
|
public const int DefaultTotal = 125;
|
||||||
|
|
||||||
|
|||||||
@@ -7,44 +7,13 @@ public static class ControlHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
static bool _invert = false;
|
static bool _invert = false;
|
||||||
static bool _darkTheme = false;
|
|
||||||
|
|
||||||
|
|
||||||
static float _scale = 1;
|
static float _scale = 1;
|
||||||
|
|
||||||
static Color formBack;
|
public static void Adjust(RForm container, bool invert = false)
|
||||||
static Color backMain;
|
|
||||||
static Color foreMain;
|
|
||||||
static Color foreAccent;
|
|
||||||
static Color borderMain;
|
|
||||||
static Color buttonMain;
|
|
||||||
|
|
||||||
public static void Adjust(RForm container, bool darkTheme = false, bool invert = false)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
_darkTheme = darkTheme;
|
container.BackColor = RForm.formBack;
|
||||||
|
container.ForeColor = RForm.foreMain;
|
||||||
if (darkTheme)
|
|
||||||
{
|
|
||||||
formBack = Color.FromArgb(255, 35, 35, 35);
|
|
||||||
backMain = Color.FromArgb(255, 50, 50, 50);
|
|
||||||
foreMain = Color.FromArgb(255, 240, 240, 240);
|
|
||||||
foreAccent = Color.FromArgb(255, 100, 100, 100);
|
|
||||||
borderMain = Color.FromArgb(255, 50, 50, 50);
|
|
||||||
buttonMain = Color.FromArgb(255, 80, 80, 80);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
formBack = SystemColors.Control;
|
|
||||||
backMain = SystemColors.ControlLightLight;
|
|
||||||
foreMain = SystemColors.ControlText;
|
|
||||||
foreAccent = Color.LightGray;
|
|
||||||
borderMain = Color.LightGray;
|
|
||||||
buttonMain = Color.FromArgb(255, 230, 230, 230);
|
|
||||||
}
|
|
||||||
|
|
||||||
container.BackColor = formBack;
|
|
||||||
container.ForeColor = foreMain;
|
|
||||||
|
|
||||||
_invert = invert;
|
_invert = invert;
|
||||||
AdjustControls(container.Controls);
|
AdjustControls(container.Controls);
|
||||||
@@ -85,11 +54,11 @@ public static class ControlHelper
|
|||||||
var button = control as RButton;
|
var button = control as RButton;
|
||||||
if (button != null)
|
if (button != null)
|
||||||
{
|
{
|
||||||
button.BackColor = button.Secondary ? buttonMain : backMain;
|
button.BackColor = button.Secondary ? RForm.buttonSecond : RForm.buttonMain;
|
||||||
button.ForeColor = foreMain;
|
button.ForeColor = RForm.foreMain;
|
||||||
|
|
||||||
button.FlatStyle = FlatStyle.Flat;
|
button.FlatStyle = FlatStyle.Flat;
|
||||||
button.FlatAppearance.BorderColor = borderMain;
|
button.FlatAppearance.BorderColor = RForm.borderMain;
|
||||||
|
|
||||||
if (button.Image is not null)
|
if (button.Image is not null)
|
||||||
button.Image = AdjustImage(button.Image);
|
button.Image = AdjustImage(button.Image);
|
||||||
@@ -103,52 +72,52 @@ public static class ControlHelper
|
|||||||
var combo = control as RComboBox;
|
var combo = control as RComboBox;
|
||||||
if (combo != null)
|
if (combo != null)
|
||||||
{
|
{
|
||||||
combo.BackColor = backMain;
|
combo.BackColor = RForm.buttonMain;
|
||||||
combo.ForeColor = foreMain;
|
combo.ForeColor = RForm.foreMain;
|
||||||
combo.BorderColor = backMain;
|
combo.BorderColor = RForm.buttonMain;
|
||||||
combo.ButtonColor = backMain;
|
combo.ButtonColor = RForm.buttonMain;
|
||||||
combo.ArrowColor = foreMain;
|
combo.ArrowColor = RForm.foreMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gb = control as GroupBox;
|
var gb = control as GroupBox;
|
||||||
if (gb != null)
|
if (gb != null)
|
||||||
{
|
{
|
||||||
gb.ForeColor = foreMain;
|
gb.ForeColor = RForm.foreMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sl = control as Slider;
|
var sl = control as Slider;
|
||||||
if (sl != null)
|
if (sl != null)
|
||||||
{
|
{
|
||||||
sl.borderColor = buttonMain;
|
sl.borderColor = RForm.buttonMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
var chk = control as CheckBox;
|
var chk = control as CheckBox;
|
||||||
if (chk != null)
|
if (chk != null && chk.Padding.Left > 5)
|
||||||
{
|
{
|
||||||
chk.BackColor = buttonMain;
|
chk.BackColor = RForm.buttonSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
var chart = control as Chart;
|
var chart = control as Chart;
|
||||||
if (chart != null)
|
if (chart != null)
|
||||||
{
|
{
|
||||||
chart.BackColor = backMain;
|
chart.BackColor = RForm.chartMain;
|
||||||
chart.ChartAreas[0].BackColor = backMain;
|
chart.ChartAreas[0].BackColor = RForm.chartMain;
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.TitleForeColor = foreMain;
|
chart.ChartAreas[0].AxisX.TitleForeColor = RForm.foreMain;
|
||||||
chart.ChartAreas[0].AxisY.TitleForeColor = foreMain;
|
chart.ChartAreas[0].AxisY.TitleForeColor = RForm.foreMain;
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.LabelStyle.ForeColor = foreMain;
|
chart.ChartAreas[0].AxisX.LabelStyle.ForeColor = RForm.foreMain;
|
||||||
chart.ChartAreas[0].AxisY.LabelStyle.ForeColor = foreMain;
|
chart.ChartAreas[0].AxisY.LabelStyle.ForeColor = RForm.foreMain;
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = foreMain;
|
chart.ChartAreas[0].AxisX.MajorTickMark.LineColor = RForm.foreMain;
|
||||||
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = foreMain;
|
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = RForm.foreMain;
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
|
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = RForm.chartGrid;
|
||||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
|
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = RForm.chartGrid;
|
||||||
chart.ChartAreas[0].AxisX.LineColor = foreAccent;
|
chart.ChartAreas[0].AxisX.LineColor = RForm.chartGrid;
|
||||||
chart.ChartAreas[0].AxisY.LineColor = foreAccent;
|
chart.ChartAreas[0].AxisY.LineColor = RForm.chartGrid;
|
||||||
|
|
||||||
chart.Titles[0].ForeColor = foreMain;
|
chart.Titles[0].ForeColor = RForm.foreMain;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -10,9 +9,18 @@ namespace CustomControls
|
|||||||
public class RForm : Form
|
public class RForm : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
protected static Color colorEco = Color.FromArgb(255, 6, 180, 138);
|
public static Color colorEco = Color.FromArgb(255, 6, 180, 138);
|
||||||
protected static Color colorStandard = Color.FromArgb(255, 58, 174, 239);
|
public static Color colorStandard = Color.FromArgb(255, 58, 174, 239);
|
||||||
protected static Color colorTurbo = Color.FromArgb(255, 255, 32, 32);
|
public static Color colorTurbo = Color.FromArgb(255, 255, 32, 32);
|
||||||
|
|
||||||
|
public static Color buttonMain;
|
||||||
|
public static Color buttonSecond;
|
||||||
|
|
||||||
|
public static Color formBack;
|
||||||
|
public static Color foreMain;
|
||||||
|
public static Color borderMain;
|
||||||
|
public static Color chartMain;
|
||||||
|
public static Color chartGrid;
|
||||||
|
|
||||||
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")]
|
[DllImport("UXTheme.dll", SetLastError = true, EntryPoint = "#138")]
|
||||||
public static extern bool CheckSystemDarkModeStatus();
|
public static extern bool CheckSystemDarkModeStatus();
|
||||||
@@ -22,6 +30,34 @@ namespace CustomControls
|
|||||||
|
|
||||||
public bool darkTheme;
|
public bool darkTheme;
|
||||||
|
|
||||||
|
public static void InitColors(bool darkTheme)
|
||||||
|
{
|
||||||
|
if (darkTheme)
|
||||||
|
{
|
||||||
|
buttonMain = Color.FromArgb(255, 55, 55, 55);
|
||||||
|
buttonSecond = Color.FromArgb(255, 38, 38, 38);
|
||||||
|
|
||||||
|
formBack = Color.FromArgb(255, 28, 28, 28);
|
||||||
|
foreMain = Color.FromArgb(255, 240, 240, 240);
|
||||||
|
borderMain = Color.FromArgb(255, 50, 50, 50);
|
||||||
|
|
||||||
|
chartMain = Color.FromArgb(255, 35, 35, 35);
|
||||||
|
chartGrid = Color.FromArgb(255, 70, 70, 70);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buttonMain = SystemColors.ControlLightLight;
|
||||||
|
buttonSecond = SystemColors.ControlLight;
|
||||||
|
|
||||||
|
formBack = SystemColors.Control;
|
||||||
|
foreMain = SystemColors.ControlText;
|
||||||
|
borderMain = Color.LightGray;
|
||||||
|
|
||||||
|
chartMain = SystemColors.ControlLightLight;
|
||||||
|
chartGrid = Color.LightGray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static bool IsDarkTheme()
|
private static bool IsDarkTheme()
|
||||||
{
|
{
|
||||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||||
@@ -37,13 +73,15 @@ namespace CustomControls
|
|||||||
bool changed = (darkTheme != newDarkTheme);
|
bool changed = (darkTheme != newDarkTheme);
|
||||||
darkTheme = newDarkTheme;
|
darkTheme = newDarkTheme;
|
||||||
|
|
||||||
|
InitColors(darkTheme);
|
||||||
|
|
||||||
if (setDPI)
|
if (setDPI)
|
||||||
ControlHelper.Resize(this);
|
ControlHelper.Resize(this);
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
|
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
|
||||||
ControlHelper.Adjust(this, darkTheme, changed);
|
ControlHelper.Adjust(this, changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
@@ -53,7 +91,13 @@ namespace CustomControls
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class RComboBox : ComboBox
|
public class RCheckBox : CheckBox
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class RComboBox : ComboBox
|
||||||
{
|
{
|
||||||
private Color borderColor = Color.Gray;
|
private Color borderColor = Color.Gray;
|
||||||
[DefaultValue(typeof(Color), "Gray")]
|
[DefaultValue(typeof(Color), "Gray")]
|
||||||
|
|||||||
22
app/Fans.Designer.cs
generated
22
app/Fans.Designer.cs
generated
@@ -47,12 +47,12 @@ namespace GHelper
|
|||||||
chartCPU = new Chart();
|
chartCPU = new Chart();
|
||||||
chartMid = new Chart();
|
chartMid = new Chart();
|
||||||
labelFans = new Label();
|
labelFans = new Label();
|
||||||
checkApplyFans = new CheckBox();
|
checkApplyFans = new RCheckBox();
|
||||||
buttonReset = new RButton();
|
buttonReset = new RButton();
|
||||||
panelPower = new Panel();
|
panelPower = new Panel();
|
||||||
pictureBox1 = new PictureBox();
|
pictureBox1 = new PictureBox();
|
||||||
labelPowerLimits = new Label();
|
labelPowerLimits = new Label();
|
||||||
checkApplyPower = new CheckBox();
|
checkApplyPower = new RCheckBox();
|
||||||
panelCPU = new Panel();
|
panelCPU = new Panel();
|
||||||
labelCPU = new Label();
|
labelCPU = new Label();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
@@ -218,20 +218,20 @@ namespace GHelper
|
|||||||
checkApplyFans.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
checkApplyFans.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
checkApplyFans.AutoSize = true;
|
checkApplyFans.AutoSize = true;
|
||||||
checkApplyFans.BackColor = SystemColors.ControlLight;
|
checkApplyFans.BackColor = SystemColors.ControlLight;
|
||||||
checkApplyFans.Location = new Point(538, 1084);
|
checkApplyFans.Location = new Point(449, 1084);
|
||||||
checkApplyFans.Margin = new Padding(4, 2, 4, 2);
|
checkApplyFans.Margin = new Padding(4, 2, 4, 2);
|
||||||
checkApplyFans.Name = "checkApplyFans";
|
checkApplyFans.Name = "checkApplyFans";
|
||||||
checkApplyFans.Padding = new Padding(15, 5, 15, 5);
|
checkApplyFans.Padding = new Padding(15, 5, 15, 5);
|
||||||
checkApplyFans.Size = new Size(250, 46);
|
checkApplyFans.Size = new Size(339, 46);
|
||||||
checkApplyFans.TabIndex = 17;
|
checkApplyFans.TabIndex = 17;
|
||||||
checkApplyFans.Text = "Apply Fan Curve";
|
checkApplyFans.Text = "Apply Custom Fan Curve";
|
||||||
checkApplyFans.UseVisualStyleBackColor = false;
|
checkApplyFans.UseVisualStyleBackColor = false;
|
||||||
//
|
//
|
||||||
// buttonReset
|
// buttonReset
|
||||||
//
|
//
|
||||||
buttonReset.Activated = false;
|
buttonReset.Activated = false;
|
||||||
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonReset.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonReset.BackColor = Color.FromArgb(230, 230, 230);
|
buttonReset.BackColor = SystemColors.ControlLight;
|
||||||
buttonReset.BorderColor = Color.Transparent;
|
buttonReset.BorderColor = Color.Transparent;
|
||||||
buttonReset.BorderRadius = 2;
|
buttonReset.BorderRadius = 2;
|
||||||
buttonReset.FlatStyle = FlatStyle.Flat;
|
buttonReset.FlatStyle = FlatStyle.Flat;
|
||||||
@@ -336,7 +336,7 @@ namespace GHelper
|
|||||||
trackCPU.Location = new Point(48, 88);
|
trackCPU.Location = new Point(48, 88);
|
||||||
trackCPU.Margin = new Padding(4, 2, 4, 2);
|
trackCPU.Margin = new Padding(4, 2, 4, 2);
|
||||||
trackCPU.Maximum = 85;
|
trackCPU.Maximum = 85;
|
||||||
trackCPU.Minimum = 15;
|
trackCPU.Minimum = 5;
|
||||||
trackCPU.Name = "trackCPU";
|
trackCPU.Name = "trackCPU";
|
||||||
trackCPU.Orientation = Orientation.Vertical;
|
trackCPU.Orientation = Orientation.Vertical;
|
||||||
trackCPU.Size = new Size(90, 416);
|
trackCPU.Size = new Size(90, 416);
|
||||||
@@ -381,8 +381,8 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
trackTotal.Location = new Point(44, 88);
|
trackTotal.Location = new Point(44, 88);
|
||||||
trackTotal.Margin = new Padding(4, 2, 4, 2);
|
trackTotal.Margin = new Padding(4, 2, 4, 2);
|
||||||
trackTotal.Maximum = 150;
|
trackTotal.Maximum = 180;
|
||||||
trackTotal.Minimum = 15;
|
trackTotal.Minimum = 10;
|
||||||
trackTotal.Name = "trackTotal";
|
trackTotal.Name = "trackTotal";
|
||||||
trackTotal.Orientation = Orientation.Vertical;
|
trackTotal.Orientation = Orientation.Vertical;
|
||||||
trackTotal.Size = new Size(90, 416);
|
trackTotal.Size = new Size(90, 416);
|
||||||
@@ -455,10 +455,10 @@ namespace GHelper
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
private Panel panelFans;
|
private Panel panelFans;
|
||||||
private CheckBox checkApplyFans;
|
private RCheckBox checkApplyFans;
|
||||||
private RButton buttonReset;
|
private RButton buttonReset;
|
||||||
private Panel panelPower;
|
private Panel panelPower;
|
||||||
private CheckBox checkApplyPower;
|
private RCheckBox checkApplyPower;
|
||||||
private Panel panelCPU;
|
private Panel panelCPU;
|
||||||
private Label labelCPU;
|
private Label labelCPU;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
|
|||||||
138
app/Fans.cs
138
app/Fans.cs
@@ -13,76 +13,6 @@ namespace GHelper
|
|||||||
Series seriesMid;
|
Series seriesMid;
|
||||||
|
|
||||||
static int MinRPM, MaxRPM;
|
static int MinRPM, MaxRPM;
|
||||||
|
|
||||||
static string ChartPercToRPM(int percentage, string unit = "")
|
|
||||||
{
|
|
||||||
if (percentage == 0) return "OFF";
|
|
||||||
|
|
||||||
return (200 * Math.Round((float)(MinRPM * 100 + (MaxRPM - MinRPM) * percentage) / 200)).ToString() + unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetChart(Chart chart, int device)
|
|
||||||
{
|
|
||||||
|
|
||||||
string title;
|
|
||||||
|
|
||||||
if (device == 1)
|
|
||||||
title = "GPU Fan Profile";
|
|
||||||
else if (device == 2)
|
|
||||||
title = "Middle Fan Profile";
|
|
||||||
else
|
|
||||||
title = "CPU Fan Profile";
|
|
||||||
|
|
||||||
if (Program.settingsForm.perfName.Length > 0)
|
|
||||||
labelFans.Text = "Fan Profiles: " + Program.settingsForm.perfName;
|
|
||||||
|
|
||||||
chart.Titles[0].Text = title;
|
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.Minimum = 10;
|
|
||||||
chart.ChartAreas[0].AxisX.Maximum = 100;
|
|
||||||
chart.ChartAreas[0].AxisX.Interval = 10;
|
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisY.Minimum = 0;
|
|
||||||
chart.ChartAreas[0].AxisY.Maximum = 100;
|
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
|
|
||||||
|
|
||||||
var foreAccent = Color.FromArgb(255, 180, 180, 180);
|
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
|
|
||||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
|
|
||||||
chart.ChartAreas[0].AxisX.LineColor = foreAccent;
|
|
||||||
chart.ChartAreas[0].AxisY.LineColor = foreAccent;
|
|
||||||
|
|
||||||
for (int i = 0; i <= 90; i += 10)
|
|
||||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i));
|
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, "RPM");
|
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisY.Interval = 10;
|
|
||||||
|
|
||||||
if (chart.Legends.Count > 0)
|
|
||||||
chart.Legends[0].Enabled = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Fans_Shown(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (Height > Program.settingsForm.Height)
|
|
||||||
{
|
|
||||||
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MinimumSize = new Size(0, Program.settingsForm.Height);
|
|
||||||
Height = Program.settingsForm.Height;
|
|
||||||
Top = Program.settingsForm.Top;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Left = Program.settingsForm.Left - Width - 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Fans()
|
public Fans()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -146,6 +76,74 @@ namespace GHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string ChartPercToRPM(int percentage, string unit = "")
|
||||||
|
{
|
||||||
|
if (percentage == 0) return "OFF";
|
||||||
|
|
||||||
|
return (200 * Math.Round((float)(MinRPM * 100 + (MaxRPM - MinRPM) * percentage) / 200)).ToString() + unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetChart(Chart chart, int device)
|
||||||
|
{
|
||||||
|
|
||||||
|
string title;
|
||||||
|
|
||||||
|
if (device == 1)
|
||||||
|
title = "GPU Fan Profile";
|
||||||
|
else if (device == 2)
|
||||||
|
title = "Middle Fan Profile";
|
||||||
|
else
|
||||||
|
title = "CPU Fan Profile";
|
||||||
|
|
||||||
|
if (Program.settingsForm.perfName.Length > 0)
|
||||||
|
labelFans.Text = "Fan Profiles: " + Program.settingsForm.perfName;
|
||||||
|
|
||||||
|
chart.Titles[0].Text = title;
|
||||||
|
|
||||||
|
chart.ChartAreas[0].AxisX.Minimum = 10;
|
||||||
|
chart.ChartAreas[0].AxisX.Maximum = 100;
|
||||||
|
chart.ChartAreas[0].AxisX.Interval = 10;
|
||||||
|
|
||||||
|
chart.ChartAreas[0].AxisY.Minimum = 0;
|
||||||
|
chart.ChartAreas[0].AxisY.Maximum = 100;
|
||||||
|
|
||||||
|
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
|
||||||
|
|
||||||
|
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = chartGrid;
|
||||||
|
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = chartGrid;
|
||||||
|
chart.ChartAreas[0].AxisX.LineColor = chartGrid;
|
||||||
|
chart.ChartAreas[0].AxisY.LineColor = chartGrid;
|
||||||
|
|
||||||
|
for (int i = 0; i <= 90; i += 10)
|
||||||
|
chart.ChartAreas[0].AxisY.CustomLabels.Add(i - 2, i + 2, ChartPercToRPM(i));
|
||||||
|
|
||||||
|
chart.ChartAreas[0].AxisY.CustomLabels.Add(98, 102, "RPM");
|
||||||
|
|
||||||
|
chart.ChartAreas[0].AxisY.Interval = 10;
|
||||||
|
|
||||||
|
if (chart.Legends.Count > 0)
|
||||||
|
chart.Legends[0].Enabled = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Fans_Shown(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Height > Program.settingsForm.Height)
|
||||||
|
{
|
||||||
|
Top = Program.settingsForm.Top + Program.settingsForm.Height - Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MinimumSize = new Size(0, Program.settingsForm.Height);
|
||||||
|
Height = Program.settingsForm.Height;
|
||||||
|
Top = Program.settingsForm.Top;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Left = Program.settingsForm.Left - Width - 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void TrackPower_MouseUp(object? sender, MouseEventArgs e)
|
private void TrackPower_MouseUp(object? sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
Program.settingsForm.AutoPower();
|
Program.settingsForm.AutoPower();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.46</AssemblyVersion>
|
<AssemblyVersion>0.48</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -73,6 +73,24 @@ public class AmdGpuTemperatureProvider : IGpuTemperatureProvider {
|
|||||||
return temperatureSensor.Value;
|
return temperatureSensor.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int? GetGpuUse()
|
||||||
|
{
|
||||||
|
if (!IsValid)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (Adl2.NativeMethods.ADL2_New_QueryPMLogData_Get(_adlContextHandle, _internalDiscreteAdapter.AdapterIndex, out ADLPMLogDataOutput adlpmLogDataOutput) != Adl2.ADL_SUCCESS)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
ADLSingleSensorData gpuUsage = adlpmLogDataOutput.Sensors[(int)ADLSensorType.PMLOG_INFO_ACTIVITY_GFX];
|
||||||
|
if (gpuUsage.Supported == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return gpuUsage.Value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ReleaseUnmanagedResources() {
|
private void ReleaseUnmanagedResources() {
|
||||||
if (_adlContextHandle != IntPtr.Zero) {
|
if (_adlContextHandle != IntPtr.Zero) {
|
||||||
Adl2.NativeMethods.ADL2_Main_Control_Destroy(_adlContextHandle);
|
Adl2.NativeMethods.ADL2_Main_Control_Destroy(_adlContextHandle);
|
||||||
|
|||||||
@@ -3,4 +3,5 @@
|
|||||||
public interface IGpuTemperatureProvider : IDisposable {
|
public interface IGpuTemperatureProvider : IDisposable {
|
||||||
bool IsValid { get; }
|
bool IsValid { get; }
|
||||||
int? GetCurrentTemperature();
|
int? GetCurrentTemperature();
|
||||||
|
int? GetGpuUse();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,68 @@
|
|||||||
using NvAPIWrapper.GPU;
|
using NvAPIWrapper.GPU;
|
||||||
using NvAPIWrapper.Native;
|
using NvAPIWrapper.Native;
|
||||||
using NvAPIWrapper.Native.Exceptions;
|
|
||||||
using NvAPIWrapper.Native.GPU;
|
using NvAPIWrapper.Native.GPU;
|
||||||
using NvAPIWrapper.Native.Interfaces.GPU;
|
using NvAPIWrapper.Native.Interfaces.GPU;
|
||||||
|
|
||||||
namespace GHelper.Gpu;
|
namespace GHelper.Gpu;
|
||||||
|
|
||||||
public class NvidiaGpuTemperatureProvider : IGpuTemperatureProvider {
|
public class NvidiaGpuTemperatureProvider : IGpuTemperatureProvider
|
||||||
|
{
|
||||||
private readonly PhysicalGPU? _internalGpu;
|
private readonly PhysicalGPU? _internalGpu;
|
||||||
|
|
||||||
public NvidiaGpuTemperatureProvider() {
|
public NvidiaGpuTemperatureProvider()
|
||||||
|
{
|
||||||
_internalGpu = GetInternalDiscreteGpu();
|
_internalGpu = GetInternalDiscreteGpu();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsValid => _internalGpu != null;
|
public bool IsValid => _internalGpu != null;
|
||||||
|
|
||||||
public int? GetCurrentTemperature() {
|
public int? GetCurrentTemperature()
|
||||||
|
{
|
||||||
if (!IsValid)
|
if (!IsValid)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
PhysicalGPU internalGpu = _internalGpu!;
|
PhysicalGPU internalGpu = _internalGpu!;
|
||||||
IThermalSensor? gpuSensor =
|
IThermalSensor? gpuSensor =
|
||||||
GPUApi.GetThermalSettings(internalGpu.Handle).Sensors
|
GPUApi.GetThermalSettings(internalGpu.Handle).Sensors
|
||||||
.FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU);
|
.FirstOrDefault(s => s.Target == ThermalSettingsTarget.GPU);
|
||||||
|
|
||||||
return gpuSensor?.CurrentTemperature;
|
return gpuSensor?.CurrentTemperature;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PhysicalGPU? GetInternalDiscreteGpu() {
|
private static PhysicalGPU? GetInternalDiscreteGpu()
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return PhysicalGPU
|
return PhysicalGPU
|
||||||
.GetPhysicalGPUs()
|
.GetPhysicalGPUs()
|
||||||
.FirstOrDefault(gpu => gpu.SystemType == SystemType.Laptop);
|
.FirstOrDefault(gpu => gpu.SystemType == SystemType.Laptop);
|
||||||
} catch {
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int? GetGpuUse()
|
||||||
|
{
|
||||||
|
if (!IsValid)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
PhysicalGPU internalGpu = _internalGpu!;
|
||||||
|
|
||||||
|
IUtilizationDomainInfo? gpuUsage = GPUApi.GetUsages(internalGpu.Handle).GPU;
|
||||||
|
|
||||||
|
if (gpuUsage == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return
|
||||||
|
(int)gpuUsage?.Percentage;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Diagnostics;
|
using GHelper;
|
||||||
using GHelper;
|
|
||||||
using GHelper.Gpu;
|
using GHelper.Gpu;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
public static class HardwareMonitor
|
public static class HardwareMonitor
|
||||||
{
|
{
|
||||||
@@ -14,6 +14,9 @@ public static class HardwareMonitor
|
|||||||
public static string? gpuFan;
|
public static string? gpuFan;
|
||||||
public static string? midFan;
|
public static string? midFan;
|
||||||
|
|
||||||
|
//public static List<int> gpuUsage = new List<int>();
|
||||||
|
public static int? gpuUse;
|
||||||
|
|
||||||
public static int GetFanMax()
|
public static int GetFanMax()
|
||||||
{
|
{
|
||||||
int max = 58;
|
int max = 58;
|
||||||
@@ -41,13 +44,29 @@ public static class HardwareMonitor
|
|||||||
if (Program.config.getConfig("fan_rpm") == 1)
|
if (Program.config.getConfig("fan_rpm") == 1)
|
||||||
return " Fan: " + (fan * 100).ToString() + "RPM";
|
return " Fan: " + (fan * 100).ToString() + "RPM";
|
||||||
else
|
else
|
||||||
return " Fan: " + Math.Min(Math.Round((float)fan/fanMax*100), 100).ToString() + "%"; // relatively to 6000 rpm
|
return " Fan: " + Math.Min(Math.Round((float)fan / fanMax * 100), 100).ToString() + "%"; // relatively to 6000 rpm
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int GetGpuUse()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int? gpuUse = GpuTemperatureProvider?.GetGpuUse();
|
||||||
|
if (gpuUse is not null) return (int)gpuUse;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(ex.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadSensors()
|
public static void ReadSensors()
|
||||||
{
|
{
|
||||||
batteryDischarge = -1;
|
batteryDischarge = -1;
|
||||||
gpuTemp = -1;
|
gpuTemp = -1;
|
||||||
|
gpuUse = -1;
|
||||||
|
|
||||||
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
cpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan));
|
||||||
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
gpuFan = FormatFan(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan));
|
||||||
@@ -55,32 +74,36 @@ public static class HardwareMonitor
|
|||||||
|
|
||||||
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
|
cpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_CPU);
|
||||||
|
|
||||||
|
|
||||||
if (cpuTemp < 0) try
|
if (cpuTemp < 0) try
|
||||||
{
|
{
|
||||||
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
var ct = new PerformanceCounter("Thermal Zone Information", "Temperature", @"\_TZ.THRM", true);
|
||||||
cpuTemp = ct.NextValue() - 273;
|
cpuTemp = ct.NextValue() - 273;
|
||||||
ct.Dispose();
|
ct.Dispose();
|
||||||
} catch
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Failed reading CPU temp");
|
Debug.WriteLine("Failed reading CPU temp");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpuTemp < 0) try
|
try
|
||||||
{
|
{
|
||||||
if (GpuTemperatureProvider is null) RecreateGpuTemperatureProvider();
|
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
||||||
gpuTemp = GpuTemperatureProvider?.GetCurrentTemperature();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex)
|
||||||
|
{
|
||||||
gpuTemp = -1;
|
gpuTemp = -1;
|
||||||
Logger.WriteLine("Failed reading GPU temp");
|
Debug.WriteLine("Failed reading GPU temp");
|
||||||
Logger.WriteLine(ex.ToString());
|
Debug.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpuTemp is null || gpuTemp < 0)
|
if (gpuTemp is null || gpuTemp < 0)
|
||||||
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
||||||
|
|
||||||
|
/*
|
||||||
|
gpuUsage.Add(GetGpuUse());
|
||||||
|
if (gpuUsage.Count > 3) gpuUsage.RemoveAt(0);
|
||||||
|
*/
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -91,15 +114,22 @@ public static class HardwareMonitor
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Logger.WriteLine("Failed reading Battery discharge");
|
Debug.WriteLine("Failed reading Battery discharge");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RecreateGpuTemperatureProviderWithDelay() {
|
public static bool IsUsedGPU(int threshold = 50)
|
||||||
|
{
|
||||||
|
return (GetGpuUse() > threshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RecreateGpuTemperatureProviderWithDelay()
|
||||||
|
{
|
||||||
|
|
||||||
// Re-enabling the discrete GPU takes a bit of time,
|
// Re-enabling the discrete GPU takes a bit of time,
|
||||||
// so a simple workaround is to refresh again after that happens
|
// so a simple workaround is to refresh again after that happens
|
||||||
Task.Run(async () => {
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(5));
|
await Task.Delay(TimeSpan.FromSeconds(5));
|
||||||
RecreateGpuTemperatureProvider();
|
RecreateGpuTemperatureProvider();
|
||||||
});
|
});
|
||||||
@@ -108,7 +138,8 @@ public static class HardwareMonitor
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RecreateGpuTemperatureProvider() {
|
public static void RecreateGpuTemperatureProvider()
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GpuTemperatureProvider?.Dispose();
|
GpuTemperatureProvider?.Dispose();
|
||||||
@@ -135,8 +166,8 @@ public static class HardwareMonitor
|
|||||||
GpuTemperatureProvider = null;
|
GpuTemperatureProvider = null;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(ex.ToString());
|
Debug.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using CustomControls;
|
using CustomControls;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
@@ -98,6 +99,16 @@ namespace GHelper
|
|||||||
private void CheckKeyboardAuto_CheckedChanged(object? sender, EventArgs e)
|
private void CheckKeyboardAuto_CheckedChanged(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Program.config.setConfig("keyboard_auto", (checkKeyboardAuto.Checked ? 1 : 0));
|
Program.config.setConfig("keyboard_auto", (checkKeyboardAuto.Checked ? 1 : 0));
|
||||||
|
|
||||||
|
/*
|
||||||
|
RegistryKey myKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\ASUS\\ASUS System Control Interface\\AsusOptimization\\ASUS Keyboard Hotkeys", true);
|
||||||
|
if (myKey != null)
|
||||||
|
{
|
||||||
|
myKey.SetValue("TurnOffKeybdLight", 30, RegistryValueKind.DWord);
|
||||||
|
myKey.Close();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckTopmost_CheckedChanged(object? sender, EventArgs e)
|
private void CheckTopmost_CheckedChanged(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ namespace GHelper
|
|||||||
|
|
||||||
SetAutoModes();
|
SetAutoModes();
|
||||||
|
|
||||||
|
HardwareMonitor.RecreateGpuTemperatureProvider();
|
||||||
|
|
||||||
// Subscribing for system power change events
|
// Subscribing for system power change events
|
||||||
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
|
||||||
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
SystemEvents.UserPreferenceChanged += SystemEvents_UserPreferenceChanged;
|
||||||
|
|||||||
11
app/Settings.Designer.cs
generated
11
app/Settings.Designer.cs
generated
@@ -163,6 +163,7 @@ namespace GHelper
|
|||||||
// comboMatrix
|
// comboMatrix
|
||||||
//
|
//
|
||||||
comboMatrix.BorderColor = Color.White;
|
comboMatrix.BorderColor = Color.White;
|
||||||
|
comboMatrix.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||||
comboMatrix.Dock = DockStyle.Top;
|
comboMatrix.Dock = DockStyle.Top;
|
||||||
comboMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
comboMatrix.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
comboMatrix.FormattingEnabled = true;
|
comboMatrix.FormattingEnabled = true;
|
||||||
@@ -178,6 +179,7 @@ namespace GHelper
|
|||||||
// comboMatrixRunning
|
// comboMatrixRunning
|
||||||
//
|
//
|
||||||
comboMatrixRunning.BorderColor = Color.White;
|
comboMatrixRunning.BorderColor = Color.White;
|
||||||
|
comboMatrixRunning.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||||
comboMatrixRunning.Dock = DockStyle.Top;
|
comboMatrixRunning.Dock = DockStyle.Top;
|
||||||
comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
comboMatrixRunning.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
comboMatrixRunning.FormattingEnabled = true;
|
comboMatrixRunning.FormattingEnabled = true;
|
||||||
@@ -193,7 +195,7 @@ namespace GHelper
|
|||||||
// buttonMatrix
|
// buttonMatrix
|
||||||
//
|
//
|
||||||
buttonMatrix.Activated = false;
|
buttonMatrix.Activated = false;
|
||||||
buttonMatrix.BackColor = Color.FromArgb(230, 230, 230);
|
buttonMatrix.BackColor = SystemColors.ControlLight;
|
||||||
buttonMatrix.BorderColor = Color.Transparent;
|
buttonMatrix.BorderColor = Color.Transparent;
|
||||||
buttonMatrix.BorderRadius = 2;
|
buttonMatrix.BorderRadius = 2;
|
||||||
buttonMatrix.Dock = DockStyle.Top;
|
buttonMatrix.Dock = DockStyle.Top;
|
||||||
@@ -333,7 +335,7 @@ namespace GHelper
|
|||||||
//
|
//
|
||||||
buttonQuit.Activated = false;
|
buttonQuit.Activated = false;
|
||||||
buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonQuit.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
buttonQuit.BackColor = Color.FromArgb(230, 230, 230);
|
buttonQuit.BackColor = SystemColors.ControlLight;
|
||||||
buttonQuit.BorderColor = Color.Transparent;
|
buttonQuit.BorderColor = Color.Transparent;
|
||||||
buttonQuit.BorderRadius = 2;
|
buttonQuit.BorderRadius = 2;
|
||||||
buttonQuit.FlatStyle = FlatStyle.Flat;
|
buttonQuit.FlatStyle = FlatStyle.Flat;
|
||||||
@@ -501,7 +503,7 @@ namespace GHelper
|
|||||||
// buttonFans
|
// buttonFans
|
||||||
//
|
//
|
||||||
buttonFans.Activated = false;
|
buttonFans.Activated = false;
|
||||||
buttonFans.BackColor = Color.FromArgb(230, 230, 230);
|
buttonFans.BackColor = SystemColors.ControlLight;
|
||||||
buttonFans.BorderColor = Color.Transparent;
|
buttonFans.BorderColor = Color.Transparent;
|
||||||
buttonFans.BorderRadius = 5;
|
buttonFans.BorderRadius = 5;
|
||||||
buttonFans.Dock = DockStyle.Fill;
|
buttonFans.Dock = DockStyle.Fill;
|
||||||
@@ -888,6 +890,7 @@ namespace GHelper
|
|||||||
// comboKeyboard
|
// comboKeyboard
|
||||||
//
|
//
|
||||||
comboKeyboard.BorderColor = Color.White;
|
comboKeyboard.BorderColor = Color.White;
|
||||||
|
comboKeyboard.ButtonColor = Color.FromArgb(255, 255, 255);
|
||||||
comboKeyboard.Dock = DockStyle.Top;
|
comboKeyboard.Dock = DockStyle.Top;
|
||||||
comboKeyboard.FlatStyle = FlatStyle.Flat;
|
comboKeyboard.FlatStyle = FlatStyle.Flat;
|
||||||
comboKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
comboKeyboard.Font = new Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
@@ -955,7 +958,7 @@ namespace GHelper
|
|||||||
// buttonKeyboard
|
// buttonKeyboard
|
||||||
//
|
//
|
||||||
buttonKeyboard.Activated = false;
|
buttonKeyboard.Activated = false;
|
||||||
buttonKeyboard.BackColor = Color.FromArgb(230, 230, 230);
|
buttonKeyboard.BackColor = SystemColors.ControlLight;
|
||||||
buttonKeyboard.BorderColor = Color.Transparent;
|
buttonKeyboard.BorderColor = Color.Transparent;
|
||||||
buttonKeyboard.BorderRadius = 2;
|
buttonKeyboard.BorderRadius = 2;
|
||||||
buttonKeyboard.Dock = DockStyle.Top;
|
buttonKeyboard.Dock = DockStyle.Top;
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ namespace GHelper
|
|||||||
public Keyboard keyb;
|
public Keyboard keyb;
|
||||||
|
|
||||||
static AnimeMatrixDevice mat;
|
static AnimeMatrixDevice mat;
|
||||||
static int matrixTick = 0;
|
|
||||||
static long lastRefresh;
|
static long lastRefresh;
|
||||||
|
|
||||||
public SettingsForm()
|
public SettingsForm()
|
||||||
@@ -272,10 +271,7 @@ namespace GHelper
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Logger.WriteLine("Monitor Power On");
|
Logger.WriteLine("Monitor Power On");
|
||||||
Program.settingsForm.BeginInvoke(delegate
|
Program.SetAutoModes();
|
||||||
{
|
|
||||||
Program.SetAutoModes();
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Logger.WriteLine("Monitor Dimmed");
|
Logger.WriteLine("Monitor Dimmed");
|
||||||
@@ -812,14 +808,14 @@ namespace GHelper
|
|||||||
HardwareMonitor.ReadSensors();
|
HardwareMonitor.ReadSensors();
|
||||||
|
|
||||||
if (HardwareMonitor.cpuTemp > 0)
|
if (HardwareMonitor.cpuTemp > 0)
|
||||||
cpuTemp = ": " + Math.Round((decimal)HardwareMonitor.cpuTemp).ToString() + "°C - ";
|
cpuTemp = ": " + Math.Round((decimal)HardwareMonitor.cpuTemp).ToString() + "°C ";
|
||||||
|
|
||||||
if (HardwareMonitor.batteryDischarge > 0)
|
if (HardwareMonitor.batteryDischarge > 0)
|
||||||
battery = "Discharging: " + Math.Round((decimal)HardwareMonitor.batteryDischarge, 1).ToString() + "W";
|
battery = "Discharging: " + Math.Round((decimal)HardwareMonitor.batteryDischarge, 1).ToString() + "W";
|
||||||
|
|
||||||
if (HardwareMonitor.gpuTemp > 0)
|
if (HardwareMonitor.gpuTemp > 0)
|
||||||
{
|
{
|
||||||
gpuTemp = $": {HardwareMonitor.gpuTemp}°C - ";
|
gpuTemp = $": {HardwareMonitor.gpuTemp}°C ";
|
||||||
}
|
}
|
||||||
|
|
||||||
Program.settingsForm.BeginInvoke(delegate
|
Program.settingsForm.BeginInvoke(delegate
|
||||||
@@ -849,10 +845,7 @@ namespace GHelper
|
|||||||
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
|
||||||
this.Activate();
|
this.Activate();
|
||||||
|
|
||||||
//aTimer.Interval = 300;
|
|
||||||
aTimer.Enabled = true;
|
aTimer.Enabled = true;
|
||||||
|
|
||||||
//RefreshSensors();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -919,7 +912,8 @@ namespace GHelper
|
|||||||
SetPower();
|
SetPower();
|
||||||
};
|
};
|
||||||
timer.Start();
|
timer.Start();
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
SetPower();
|
SetPower();
|
||||||
}
|
}
|
||||||
@@ -1013,10 +1007,10 @@ namespace GHelper
|
|||||||
|
|
||||||
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
|
if (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online)
|
||||||
Aura.ApplyBrightness(3);
|
Aura.ApplyBrightness(3);
|
||||||
//Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Up);
|
//Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Up);
|
||||||
else
|
else
|
||||||
Aura.ApplyBrightness(0);
|
Aura.ApplyBrightness(0);
|
||||||
//Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Down);
|
//Program.wmi.DeviceSet(ASUSWmi.UniversalControl, ASUSWmi.KB_Light_Down);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1073,6 +1067,13 @@ namespace GHelper
|
|||||||
if (eco == 0)
|
if (eco == 0)
|
||||||
if ((GpuAuto && Plugged != PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeEco))
|
if ((GpuAuto && Plugged != PowerLineStatus.Online) || (ForceGPU && GpuMode == ASUSWmi.GPUModeEco))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (HardwareMonitor.IsUsedGPU())
|
||||||
|
{
|
||||||
|
DialogResult dialogResult = MessageBox.Show("Your dGPU seem to be in heavy use, disable it?", "Eco Mode", MessageBoxButtons.YesNo);
|
||||||
|
if (dialogResult == DialogResult.No) return false;
|
||||||
|
}
|
||||||
|
|
||||||
SetEcoGPU(1);
|
SetEcoGPU(1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user