mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Added CPU / GPU temps monitoring and Charge/discharge rates in Watts
This commit is contained in:
@@ -2,14 +2,16 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net7.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>True</UseWindowsForms>
|
<UseWindowsForms>True</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<IsPublishable>True</IsPublishable>
|
<IsPublishable>True</IsPublishable>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<StartupObject>GHelper.Program</StartupObject>
|
<StartupObject>GHelper.Program</StartupObject>
|
||||||
<ApplicationIcon>Resources\standard.ico</ApplicationIcon>
|
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
|
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -24,13 +26,14 @@
|
|||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Resources\standard.ico">
|
<Content Include="favicon.ico">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="hidlibrary" Version="3.3.40" />
|
<PackageReference Include="hidlibrary" Version="3.3.40" />
|
||||||
|
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.1" />
|
||||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.4.33403.182
|
VisualStudioVersion = 17.4.33403.182
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GHelper", "GHelper.csproj", "{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GHelper", "GHelper.csproj", "{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B6E44CC6-5D28-4CB9-8EE2-BE9D6238E2D6}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B6E44CC6-5D28-4CB9-8EE2-BE9D6238E2D6}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
@@ -13,13 +13,19 @@ EndProject
|
|||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x64.ActiveCfg = Release|x64
|
||||||
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Debug|x64.Build.0 = Release|x64
|
||||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{D6138BB1-8FDB-4835-87EF-2FE41A3DD604}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
142
Program.cs
142
Program.cs
@@ -4,6 +4,8 @@ using System.Management;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using HidLibrary;
|
using HidLibrary;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using LibreHardwareMonitor.Hardware;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
public class ASUSWmi
|
public class ASUSWmi
|
||||||
{
|
{
|
||||||
@@ -224,6 +226,13 @@ public class NativeMethods
|
|||||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||||
int AcValueIndex);
|
int AcValueIndex);
|
||||||
|
|
||||||
|
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||||
|
static extern UInt32 PowerWriteACValueIndex(IntPtr RootPowerKey,
|
||||||
|
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||||
|
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||||
|
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||||
|
int AcValueIndex);
|
||||||
|
|
||||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||||
static extern UInt32 PowerReadACValueIndex(IntPtr RootPowerKey,
|
static extern UInt32 PowerReadACValueIndex(IntPtr RootPowerKey,
|
||||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||||
@@ -232,14 +241,15 @@ public class NativeMethods
|
|||||||
out IntPtr AcValueIndex
|
out IntPtr AcValueIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||||
static extern UInt32 PowerWriteACValueIndex(IntPtr RootPowerKey,
|
static extern UInt32 PowerReadDCValueIndex(IntPtr RootPowerKey,
|
||||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
|
||||||
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
|
||||||
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
|
||||||
int AcValueIndex);
|
out IntPtr AcValueIndex
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
|
||||||
static extern UInt32 PowerSetActiveScheme(IntPtr RootPowerKey,
|
static extern UInt32 PowerSetActiveScheme(IntPtr RootPowerKey,
|
||||||
@@ -410,7 +420,7 @@ public class NativeMethods
|
|||||||
{
|
{
|
||||||
Guid activeSchemeGuid = GetActiveScheme();
|
Guid activeSchemeGuid = GetActiveScheme();
|
||||||
|
|
||||||
var hr = PowerWriteACValueIndex(
|
var hrAC = PowerWriteACValueIndex(
|
||||||
IntPtr.Zero,
|
IntPtr.Zero,
|
||||||
activeSchemeGuid,
|
activeSchemeGuid,
|
||||||
GUID_CPU,
|
GUID_CPU,
|
||||||
@@ -418,6 +428,17 @@ public class NativeMethods
|
|||||||
boost);
|
boost);
|
||||||
|
|
||||||
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
|
|
||||||
|
var hrDC = PowerWriteDCValueIndex(
|
||||||
|
IntPtr.Zero,
|
||||||
|
activeSchemeGuid,
|
||||||
|
GUID_CPU,
|
||||||
|
GUID_BOOST,
|
||||||
|
boost);
|
||||||
|
|
||||||
|
PowerSetActiveScheme(IntPtr.Zero, activeSchemeGuid);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,6 +453,7 @@ public class Aura
|
|||||||
public const int Breathe = 1;
|
public const int Breathe = 1;
|
||||||
public const int Strobe = 2;
|
public const int Strobe = 2;
|
||||||
public const int Rainbow = 3;
|
public const int Rainbow = 3;
|
||||||
|
public const int Dingding = 10;
|
||||||
|
|
||||||
public const int SpeedSlow = 0;
|
public const int SpeedSlow = 0;
|
||||||
public const int SpeedMedium = 1;
|
public const int SpeedMedium = 1;
|
||||||
@@ -489,6 +511,106 @@ public class Aura
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class UpdateVisitor : IVisitor
|
||||||
|
{
|
||||||
|
public void VisitComputer(IComputer computer)
|
||||||
|
{
|
||||||
|
computer.Traverse(this);
|
||||||
|
}
|
||||||
|
public void VisitHardware(IHardware hardware)
|
||||||
|
{
|
||||||
|
hardware.Update();
|
||||||
|
foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this);
|
||||||
|
}
|
||||||
|
public void VisitSensor(ISensor sensor) { }
|
||||||
|
public void VisitParameter(IParameter parameter) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class HardwareMonitor
|
||||||
|
{
|
||||||
|
|
||||||
|
Computer computer;
|
||||||
|
|
||||||
|
public float? cpuTemp = -1;
|
||||||
|
public float? gpuTemp = -1;
|
||||||
|
public float? batteryDischarge = -1;
|
||||||
|
public float? batteryCharge = -1;
|
||||||
|
|
||||||
|
public HardwareMonitor()
|
||||||
|
{
|
||||||
|
computer = new Computer
|
||||||
|
{
|
||||||
|
IsCpuEnabled = true,
|
||||||
|
IsGpuEnabled = true,
|
||||||
|
IsBatteryEnabled = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReadSensors()
|
||||||
|
{
|
||||||
|
|
||||||
|
computer.Open();
|
||||||
|
computer.Accept(new UpdateVisitor());
|
||||||
|
|
||||||
|
cpuTemp = -1;
|
||||||
|
gpuTemp = -1;
|
||||||
|
batteryDischarge = -1;
|
||||||
|
batteryCharge = -1;
|
||||||
|
|
||||||
|
foreach (IHardware hardware in computer.Hardware)
|
||||||
|
{
|
||||||
|
//Debug.WriteLine("Hardware: {0}", hardware.Name);
|
||||||
|
//Debug.WriteLine("Hardware: {0}", hardware.HardwareType);
|
||||||
|
|
||||||
|
foreach (ISensor sensor in hardware.Sensors)
|
||||||
|
{
|
||||||
|
if (sensor.SensorType == SensorType.Temperature)
|
||||||
|
{
|
||||||
|
if (hardware.HardwareType.ToString().Contains("Cpu") && sensor.Name.Contains("Core"))
|
||||||
|
{
|
||||||
|
cpuTemp = sensor.Value;
|
||||||
|
//Debug.WriteLine("\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hardware.HardwareType.ToString().Contains("Gpu") && sensor.Name.Contains("Core"))
|
||||||
|
{
|
||||||
|
gpuTemp = sensor.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Debug.WriteLine("\tSensor: {0}, value: {1}", sensor.Name, sensor.Value);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (sensor.SensorType == SensorType.Power)
|
||||||
|
{
|
||||||
|
if (sensor.Name.Contains("Discharge"))
|
||||||
|
{
|
||||||
|
batteryDischarge = sensor.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sensor.Name.Contains("Charge"))
|
||||||
|
{
|
||||||
|
batteryCharge = sensor.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopReading()
|
||||||
|
{
|
||||||
|
computer.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
@@ -499,7 +621,10 @@ namespace GHelper
|
|||||||
public static AppConfig config;
|
public static AppConfig config;
|
||||||
|
|
||||||
public static SettingsForm settingsForm;
|
public static SettingsForm settingsForm;
|
||||||
|
public static ToastForm toastForm;
|
||||||
|
|
||||||
public static Startup scheduler;
|
public static Startup scheduler;
|
||||||
|
public static HardwareMonitor hwmonitor;
|
||||||
|
|
||||||
// The main entry point for the application
|
// The main entry point for the application
|
||||||
public static void Main()
|
public static void Main()
|
||||||
@@ -534,10 +659,13 @@ namespace GHelper
|
|||||||
|
|
||||||
settingsForm.SetStartupCheck(scheduler.IsScheduled());
|
settingsForm.SetStartupCheck(scheduler.IsScheduled());
|
||||||
|
|
||||||
bool isPlugged = (SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online);
|
bool isPlugged = (System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus == PowerLineStatus.Online);
|
||||||
settingsForm.AutoGPUMode(isPlugged ? 1 : 0);
|
settingsForm.AutoGPUMode(isPlugged ? 1 : 0);
|
||||||
settingsForm.AutoScreen(isPlugged ? 1 : 0);
|
settingsForm.AutoScreen(isPlugged ? 1 : 0);
|
||||||
|
|
||||||
|
hwmonitor = new HardwareMonitor();
|
||||||
|
IntPtr dummy = settingsForm.Handle;
|
||||||
|
|
||||||
Application.Run();
|
Application.Run();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -557,10 +685,12 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
case 56: // Rog button
|
case 56: // Rog button
|
||||||
case 174: // FN+F5
|
case 174: // FN+F5
|
||||||
|
|
||||||
settingsForm.BeginInvoke(delegate
|
settingsForm.BeginInvoke(delegate
|
||||||
{
|
{
|
||||||
settingsForm.CyclePerformanceMode();
|
settingsForm.CyclePerformanceMode();
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case 179: // FN+F4
|
case 179: // FN+F4
|
||||||
settingsForm.BeginInvoke(delegate
|
settingsForm.BeginInvoke(delegate
|
||||||
|
|||||||
10
Properties/Resources.Designer.cs
generated
10
Properties/Resources.Designer.cs
generated
@@ -110,6 +110,16 @@ namespace GHelper.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap icons8_speed_96 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8-speed-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>
|
||||||
|
|||||||
@@ -142,4 +142,7 @@
|
|||||||
<data name="icons8-laptop-48" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<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>
|
<value>..\Resources\icons8-laptop-48.png;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">
|
||||||
|
<value>..\Resources\icons8-speed-96.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
Resources/icons8-speed-96.png
Normal file
BIN
Resources/icons8-speed-96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
73
Settings.Designer.cs
generated
73
Settings.Designer.cs
generated
@@ -31,8 +31,7 @@
|
|||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
|
||||||
this.checkStartup = new System.Windows.Forms.CheckBox();
|
this.checkStartup = new System.Windows.Forms.CheckBox();
|
||||||
this.trackBattery = new System.Windows.Forms.TrackBar();
|
this.trackBattery = new System.Windows.Forms.TrackBar();
|
||||||
this.labelBattery = new System.Windows.Forms.Label();
|
this.labelBatteryTitle = new System.Windows.Forms.Label();
|
||||||
this.labelBatteryLimit = new System.Windows.Forms.Label();
|
|
||||||
this.pictureBattery = new System.Windows.Forms.PictureBox();
|
this.pictureBattery = new System.Windows.Forms.PictureBox();
|
||||||
this.labelGPUFan = new System.Windows.Forms.Label();
|
this.labelGPUFan = new System.Windows.Forms.Label();
|
||||||
this.tableGPU = new System.Windows.Forms.TableLayoutPanel();
|
this.tableGPU = new System.Windows.Forms.TableLayoutPanel();
|
||||||
@@ -62,6 +61,7 @@
|
|||||||
this.comboKeyboard = new System.Windows.Forms.ComboBox();
|
this.comboKeyboard = new System.Windows.Forms.ComboBox();
|
||||||
this.buttonKeyboardColor = new System.Windows.Forms.Button();
|
this.buttonKeyboardColor = new System.Windows.Forms.Button();
|
||||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
||||||
|
this.labelBattery = new System.Windows.Forms.Label();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBattery)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBattery)).BeginInit();
|
||||||
this.tableGPU.SuspendLayout();
|
this.tableGPU.SuspendLayout();
|
||||||
@@ -76,9 +76,8 @@
|
|||||||
//
|
//
|
||||||
// checkStartup
|
// checkStartup
|
||||||
//
|
//
|
||||||
this.checkStartup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.checkStartup.AutoSize = true;
|
this.checkStartup.AutoSize = true;
|
||||||
this.checkStartup.Location = new System.Drawing.Point(31, 1022);
|
this.checkStartup.Location = new System.Drawing.Point(40, 1007);
|
||||||
this.checkStartup.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
this.checkStartup.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||||
this.checkStartup.Name = "checkStartup";
|
this.checkStartup.Name = "checkStartup";
|
||||||
this.checkStartup.Size = new System.Drawing.Size(206, 36);
|
this.checkStartup.Size = new System.Drawing.Size(206, 36);
|
||||||
@@ -92,7 +91,7 @@
|
|||||||
this.trackBattery.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.trackBattery.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.trackBattery.LargeChange = 20;
|
this.trackBattery.LargeChange = 20;
|
||||||
this.trackBattery.Location = new System.Drawing.Point(20, 919);
|
this.trackBattery.Location = new System.Drawing.Point(20, 908);
|
||||||
this.trackBattery.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
this.trackBattery.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||||
this.trackBattery.Maximum = 100;
|
this.trackBattery.Maximum = 100;
|
||||||
this.trackBattery.Minimum = 50;
|
this.trackBattery.Minimum = 50;
|
||||||
@@ -104,33 +103,22 @@
|
|||||||
this.trackBattery.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
|
this.trackBattery.TickStyle = System.Windows.Forms.TickStyle.TopLeft;
|
||||||
this.trackBattery.Value = 100;
|
this.trackBattery.Value = 100;
|
||||||
//
|
//
|
||||||
// labelBattery
|
// labelBatteryTitle
|
||||||
//
|
//
|
||||||
this.labelBattery.AutoSize = true;
|
this.labelBatteryTitle.AutoSize = true;
|
||||||
this.labelBattery.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
this.labelBatteryTitle.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||||
this.labelBattery.Location = new System.Drawing.Point(77, 877);
|
this.labelBatteryTitle.Location = new System.Drawing.Point(77, 871);
|
||||||
this.labelBattery.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.labelBatteryTitle.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.labelBattery.Name = "labelBattery";
|
this.labelBatteryTitle.Name = "labelBatteryTitle";
|
||||||
this.labelBattery.Size = new System.Drawing.Size(248, 32);
|
this.labelBatteryTitle.Size = new System.Drawing.Size(248, 32);
|
||||||
this.labelBattery.TabIndex = 4;
|
this.labelBatteryTitle.TabIndex = 4;
|
||||||
this.labelBattery.Text = "Battery Charge Limit";
|
this.labelBatteryTitle.Text = "Battery Charge Limit";
|
||||||
//
|
|
||||||
// labelBatteryLimit
|
|
||||||
//
|
|
||||||
this.labelBatteryLimit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.labelBatteryLimit.AutoSize = true;
|
|
||||||
this.labelBatteryLimit.Location = new System.Drawing.Point(633, 874);
|
|
||||||
this.labelBatteryLimit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
|
||||||
this.labelBatteryLimit.Name = "labelBatteryLimit";
|
|
||||||
this.labelBatteryLimit.Size = new System.Drawing.Size(73, 32);
|
|
||||||
this.labelBatteryLimit.TabIndex = 5;
|
|
||||||
this.labelBatteryLimit.Text = "100%";
|
|
||||||
//
|
//
|
||||||
// pictureBattery
|
// pictureBattery
|
||||||
//
|
//
|
||||||
this.pictureBattery.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBattery.BackgroundImage")));
|
this.pictureBattery.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBattery.BackgroundImage")));
|
||||||
this.pictureBattery.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
this.pictureBattery.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
this.pictureBattery.Location = new System.Drawing.Point(33, 875);
|
this.pictureBattery.Location = new System.Drawing.Point(33, 868);
|
||||||
this.pictureBattery.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
this.pictureBattery.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||||
this.pictureBattery.Name = "pictureBattery";
|
this.pictureBattery.Name = "pictureBattery";
|
||||||
this.pictureBattery.Size = new System.Drawing.Size(38, 38);
|
this.pictureBattery.Size = new System.Drawing.Size(38, 38);
|
||||||
@@ -140,13 +128,13 @@
|
|||||||
// labelGPUFan
|
// labelGPUFan
|
||||||
//
|
//
|
||||||
this.labelGPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.labelGPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.labelGPUFan.AutoSize = true;
|
this.labelGPUFan.Location = new System.Drawing.Point(425, 262);
|
||||||
this.labelGPUFan.Location = new System.Drawing.Point(546, 262);
|
|
||||||
this.labelGPUFan.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.labelGPUFan.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.labelGPUFan.Name = "labelGPUFan";
|
this.labelGPUFan.Name = "labelGPUFan";
|
||||||
this.labelGPUFan.Size = new System.Drawing.Size(155, 32);
|
this.labelGPUFan.Size = new System.Drawing.Size(277, 32);
|
||||||
this.labelGPUFan.TabIndex = 8;
|
this.labelGPUFan.TabIndex = 8;
|
||||||
this.labelGPUFan.Text = "GPU Fan : 0%";
|
this.labelGPUFan.Text = "GPU Fan : 0%";
|
||||||
|
this.labelGPUFan.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
// tableGPU
|
// tableGPU
|
||||||
//
|
//
|
||||||
@@ -235,13 +223,13 @@
|
|||||||
// labelCPUFan
|
// labelCPUFan
|
||||||
//
|
//
|
||||||
this.labelCPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.labelCPUFan.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.labelCPUFan.AutoSize = true;
|
this.labelCPUFan.Location = new System.Drawing.Point(425, 38);
|
||||||
this.labelCPUFan.Location = new System.Drawing.Point(546, 38);
|
|
||||||
this.labelCPUFan.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
this.labelCPUFan.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.labelCPUFan.Name = "labelCPUFan";
|
this.labelCPUFan.Name = "labelCPUFan";
|
||||||
this.labelCPUFan.Size = new System.Drawing.Size(154, 32);
|
this.labelCPUFan.Size = new System.Drawing.Size(277, 32);
|
||||||
this.labelCPUFan.TabIndex = 12;
|
this.labelCPUFan.TabIndex = 12;
|
||||||
this.labelCPUFan.Text = "CPU Fan : 0%";
|
this.labelCPUFan.Text = "CPU Fan : 0%";
|
||||||
|
this.labelCPUFan.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
// tablePerf
|
// tablePerf
|
||||||
//
|
//
|
||||||
@@ -346,7 +334,7 @@
|
|||||||
//
|
//
|
||||||
// buttonQuit
|
// buttonQuit
|
||||||
//
|
//
|
||||||
this.buttonQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonQuit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonQuit.BackColor = System.Drawing.SystemColors.ButtonFace;
|
this.buttonQuit.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||||
this.buttonQuit.Location = new System.Drawing.Point(591, 1011);
|
this.buttonQuit.Location = new System.Drawing.Point(591, 1011);
|
||||||
this.buttonQuit.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
this.buttonQuit.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
|
||||||
@@ -514,11 +502,23 @@
|
|||||||
this.pictureBox2.TabIndex = 26;
|
this.pictureBox2.TabIndex = 26;
|
||||||
this.pictureBox2.TabStop = false;
|
this.pictureBox2.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// labelBattery
|
||||||
|
//
|
||||||
|
this.labelBattery.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.labelBattery.Location = new System.Drawing.Point(491, 869);
|
||||||
|
this.labelBattery.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
|
this.labelBattery.Name = "labelBattery";
|
||||||
|
this.labelBattery.Size = new System.Drawing.Size(211, 32);
|
||||||
|
this.labelBattery.TabIndex = 27;
|
||||||
|
this.labelBattery.Text = " ";
|
||||||
|
this.labelBattery.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
|
//
|
||||||
// SettingsForm
|
// SettingsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(744, 1085);
|
this.ClientSize = new System.Drawing.Size(744, 1085);
|
||||||
|
this.Controls.Add(this.labelBattery);
|
||||||
this.Controls.Add(this.buttonKeyboardColor);
|
this.Controls.Add(this.buttonKeyboardColor);
|
||||||
this.Controls.Add(this.comboKeyboard);
|
this.Controls.Add(this.comboKeyboard);
|
||||||
this.Controls.Add(this.pictureBox1);
|
this.Controls.Add(this.pictureBox1);
|
||||||
@@ -539,8 +539,7 @@
|
|||||||
this.Controls.Add(this.labelGPUFan);
|
this.Controls.Add(this.labelGPUFan);
|
||||||
this.Controls.Add(this.tableGPU);
|
this.Controls.Add(this.tableGPU);
|
||||||
this.Controls.Add(this.pictureBattery);
|
this.Controls.Add(this.pictureBattery);
|
||||||
this.Controls.Add(this.labelBatteryLimit);
|
this.Controls.Add(this.labelBatteryTitle);
|
||||||
this.Controls.Add(this.labelBattery);
|
|
||||||
this.Controls.Add(this.trackBattery);
|
this.Controls.Add(this.trackBattery);
|
||||||
this.Controls.Add(this.checkStartup);
|
this.Controls.Add(this.checkStartup);
|
||||||
this.Controls.Add(this.pictureBox2);
|
this.Controls.Add(this.pictureBox2);
|
||||||
@@ -574,8 +573,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
private CheckBox checkStartup;
|
private CheckBox checkStartup;
|
||||||
private TrackBar trackBattery;
|
private TrackBar trackBattery;
|
||||||
private Label labelBattery;
|
private Label labelBatteryTitle;
|
||||||
private Label labelBatteryLimit;
|
|
||||||
private PictureBox pictureBattery;
|
private PictureBox pictureBattery;
|
||||||
private Label labelGPUFan;
|
private Label labelGPUFan;
|
||||||
private TableLayoutPanel tableGPU;
|
private TableLayoutPanel tableGPU;
|
||||||
@@ -605,5 +603,6 @@
|
|||||||
private ComboBox comboKeyboard;
|
private ComboBox comboKeyboard;
|
||||||
private Button buttonKeyboardColor;
|
private Button buttonKeyboardColor;
|
||||||
private PictureBox pictureBox2;
|
private PictureBox pictureBox2;
|
||||||
|
private Label labelBattery;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
91
Settings.cs
91
Settings.cs
@@ -1,11 +1,9 @@
|
|||||||
using Microsoft.VisualBasic.ApplicationServices;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Management;
|
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace GHelper
|
namespace GHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class SettingsForm : Form
|
public partial class SettingsForm : Form
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -114,9 +112,11 @@ namespace GHelper
|
|||||||
buttonKeyboardColor.FlatAppearance.BorderColor = color;
|
buttonKeyboardColor.FlatAppearance.BorderColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAuraMode (int mode = 0, bool apply = true)
|
public void SetAuraMode(int mode = 0, bool apply = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//Debug.WriteLine(mode);
|
||||||
|
|
||||||
if (mode > 3) mode = 0;
|
if (mode > 3) mode = 0;
|
||||||
|
|
||||||
if (Aura.Mode == mode) return; // same mode
|
if (Aura.Mode == mode) return; // same mode
|
||||||
@@ -124,13 +124,16 @@ namespace GHelper
|
|||||||
Aura.Mode = mode;
|
Aura.Mode = mode;
|
||||||
Program.config.setConfig("aura_mode", mode);
|
Program.config.setConfig("aura_mode", mode);
|
||||||
|
|
||||||
|
comboKeyboard.SelectedValueChanged -= ComboKeyboard_SelectedValueChanged;
|
||||||
|
comboKeyboard.SelectedIndex = mode;
|
||||||
|
comboKeyboard.SelectedValueChanged += ComboKeyboard_SelectedValueChanged;
|
||||||
|
|
||||||
if (apply)
|
if (apply)
|
||||||
Aura.ApplyAura();
|
Aura.ApplyAura();
|
||||||
else
|
|
||||||
comboKeyboard.SelectedIndex = mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CycleAuraMode ()
|
public void CycleAuraMode()
|
||||||
{
|
{
|
||||||
SetAuraMode(Program.config.getConfig("aura_mode") + 1);
|
SetAuraMode(Program.config.getConfig("aura_mode") + 1);
|
||||||
}
|
}
|
||||||
@@ -183,7 +186,8 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
if (overdrive > 0)
|
if (overdrive > 0)
|
||||||
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
Program.wmi.DeviceSet(ASUSWmi.ScreenOverdrive, overdrive);
|
||||||
} catch
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Screen Overdrive not supported");
|
Debug.WriteLine("Screen Overdrive not supported");
|
||||||
}
|
}
|
||||||
@@ -226,7 +230,8 @@ namespace GHelper
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
|
overdrive = Program.wmi.DeviceGet(ASUSWmi.ScreenOverdrive);
|
||||||
} catch
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Screen Overdrive not supported");
|
Debug.WriteLine("Screen Overdrive not supported");
|
||||||
}
|
}
|
||||||
@@ -294,15 +299,40 @@ namespace GHelper
|
|||||||
aTimer.AutoReset = true;
|
aTimer.AutoReset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnTimedEvent(Object source, ElapsedEventArgs e)
|
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
|
||||||
{
|
{
|
||||||
var cpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan) / 0.6);
|
string cpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.CPU_Fan) / 0.6).ToString() + "%";
|
||||||
var gpuFan = Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6);
|
string gpuFan = " Fan: " + Math.Round(Program.wmi.DeviceGet(ASUSWmi.GPU_Fan) / 0.6) + "%";
|
||||||
|
|
||||||
|
string cpuTemp = "";
|
||||||
|
string gpuTemp = "";
|
||||||
|
string battery = "";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Program.hwmonitor.ReadSensors();
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
Debug.WriteLine("Failed reading sensors");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Program.hwmonitor.cpuTemp > 0)
|
||||||
|
cpuTemp = ": " + Math.Round((decimal)Program.hwmonitor.cpuTemp).ToString() + "°C - ";
|
||||||
|
|
||||||
|
if (Program.hwmonitor.gpuTemp > 0)
|
||||||
|
gpuTemp = ": " + Math.Round((decimal)Program.hwmonitor.gpuTemp).ToString() + "°C - ";
|
||||||
|
|
||||||
|
if (Program.hwmonitor.batteryDischarge > 0)
|
||||||
|
battery = "Discharging: " + Math.Round((decimal)Program.hwmonitor.batteryDischarge, 1).ToString() + "W";
|
||||||
|
|
||||||
|
if (Program.hwmonitor.batteryCharge > 0)
|
||||||
|
battery = "Charging: " + Math.Round((decimal)Program.hwmonitor.batteryCharge, 1).ToString() + "W";
|
||||||
|
|
||||||
Program.settingsForm.BeginInvoke(delegate
|
Program.settingsForm.BeginInvoke(delegate
|
||||||
{
|
{
|
||||||
Program.settingsForm.labelCPUFan.Text = "CPU Fan: " + cpuFan.ToString() + "%";
|
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + cpuFan;
|
||||||
Program.settingsForm.labelGPUFan.Text = "GPU Fan: " + gpuFan.ToString() + "%";
|
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + gpuFan;
|
||||||
|
Program.settingsForm.labelBattery.Text = battery;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -317,16 +347,20 @@ 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.Enabled = true;
|
aTimer.Enabled = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aTimer.Enabled = false;
|
aTimer.Enabled = false;
|
||||||
|
Program.hwmonitor.StopReading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
public void SetPerformanceMode(int PerformanceMode = ASUSWmi.PerformanceBalanced, bool notify = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string perfName;
|
||||||
|
|
||||||
buttonSilent.FlatAppearance.BorderSize = buttonInactive;
|
buttonSilent.FlatAppearance.BorderSize = buttonInactive;
|
||||||
buttonBalanced.FlatAppearance.BorderSize = buttonInactive;
|
buttonBalanced.FlatAppearance.BorderSize = buttonInactive;
|
||||||
buttonTurbo.FlatAppearance.BorderSize = buttonInactive;
|
buttonTurbo.FlatAppearance.BorderSize = buttonInactive;
|
||||||
@@ -335,25 +369,25 @@ namespace GHelper
|
|||||||
{
|
{
|
||||||
case ASUSWmi.PerformanceSilent:
|
case ASUSWmi.PerformanceSilent:
|
||||||
buttonSilent.FlatAppearance.BorderSize = buttonActive;
|
buttonSilent.FlatAppearance.BorderSize = buttonActive;
|
||||||
labelPerf.Text = "Performance Mode: Silent";
|
perfName = "Silent";
|
||||||
break;
|
break;
|
||||||
case ASUSWmi.PerformanceTurbo:
|
case ASUSWmi.PerformanceTurbo:
|
||||||
buttonTurbo.FlatAppearance.BorderSize = buttonActive;
|
buttonTurbo.FlatAppearance.BorderSize = buttonActive;
|
||||||
labelPerf.Text = "Performance Mode: Turbo";
|
perfName = "Turbo";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
buttonBalanced.FlatAppearance.BorderSize = buttonActive;
|
buttonBalanced.FlatAppearance.BorderSize = buttonActive;
|
||||||
labelPerf.Text = "Performance Mode: Balanced";
|
|
||||||
PerformanceMode = ASUSWmi.PerformanceBalanced;
|
PerformanceMode = ASUSWmi.PerformanceBalanced;
|
||||||
|
perfName = "Balanced";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Program.config.setConfig("performance_mode", PerformanceMode);
|
Program.config.setConfig("performance_mode", PerformanceMode);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
Program.wmi.DeviceSet(ASUSWmi.PerformanceMode, PerformanceMode);
|
||||||
} catch
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
labelPerf.Text = "Performance Mode: not supported";
|
labelPerf.Text = "Performance Mode: not supported";
|
||||||
}
|
}
|
||||||
@@ -376,6 +410,8 @@ namespace GHelper
|
|||||||
else
|
else
|
||||||
SetScreen(60, 0);
|
SetScreen(60, 0);
|
||||||
|
|
||||||
|
InitScreen();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AutoGPUMode(int Plugged = 1)
|
public void AutoGPUMode(int Plugged = 1)
|
||||||
@@ -396,18 +432,12 @@ namespace GHelper
|
|||||||
if (eco == 1 && Plugged == 1) // Eco going Standard on plugged
|
if (eco == 1 && Plugged == 1) // Eco going Standard on plugged
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 0);
|
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 0);
|
||||||
|
InitGPUMode();
|
||||||
GPUMode = ASUSWmi.GPUModeStandard;
|
|
||||||
VisualiseGPUMode(GPUMode);
|
|
||||||
Program.config.setConfig("gpu_mode", GPUMode);
|
|
||||||
}
|
}
|
||||||
else if (eco == 0 && Plugged == 0) // Standard going Eco on plugged
|
else if (eco == 0 && Plugged == 0) // Standard going Eco on plugged
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 1);
|
Program.wmi.DeviceSet(ASUSWmi.GPUEco, 1);
|
||||||
|
InitGPUMode();
|
||||||
GPUMode = ASUSWmi.GPUModeEco;
|
|
||||||
VisualiseGPUMode(GPUMode);
|
|
||||||
Program.config.setConfig("gpu_mode", GPUMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -584,12 +614,13 @@ namespace GHelper
|
|||||||
|
|
||||||
if (limit < 50 || limit > 100) limit = 100;
|
if (limit < 50 || limit > 100) limit = 100;
|
||||||
|
|
||||||
labelBatteryLimit.Text = limit.ToString() + "%";
|
labelBatteryTitle.Text = "Battery Charge Limit: " + limit.ToString() + "%";
|
||||||
trackBattery.Value = limit;
|
trackBattery.Value = limit;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
Program.wmi.DeviceSet(ASUSWmi.BatteryLimit, limit);
|
||||||
} catch
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Can't set battery charge limit");
|
Debug.WriteLine("Can't set battery charge limit");
|
||||||
}
|
}
|
||||||
|
|||||||
85
ToastForm.Designer.cs
generated
Normal file
85
ToastForm.Designer.cs
generated
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
namespace GHelper
|
||||||
|
{
|
||||||
|
partial class ToastForm
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.pictureIcon = new System.Windows.Forms.PictureBox();
|
||||||
|
this.labelMode = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureIcon)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureIcon
|
||||||
|
//
|
||||||
|
this.pictureIcon.BackgroundImage = global::GHelper.Properties.Resources.icons8_speed_96;
|
||||||
|
this.pictureIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.pictureIcon.Location = new System.Drawing.Point(21, 21);
|
||||||
|
this.pictureIcon.Name = "pictureIcon";
|
||||||
|
this.pictureIcon.Size = new System.Drawing.Size(82, 80);
|
||||||
|
this.pictureIcon.TabIndex = 0;
|
||||||
|
this.pictureIcon.TabStop = false;
|
||||||
|
//
|
||||||
|
// labelMode
|
||||||
|
//
|
||||||
|
this.labelMode.AutoSize = true;
|
||||||
|
this.labelMode.Font = new System.Drawing.Font("Segoe UI", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.labelMode.Location = new System.Drawing.Point(127, 32);
|
||||||
|
this.labelMode.Name = "labelMode";
|
||||||
|
this.labelMode.Size = new System.Drawing.Size(195, 59);
|
||||||
|
this.labelMode.TabIndex = 1;
|
||||||
|
this.labelMode.Text = "Balanced";
|
||||||
|
this.labelMode.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
|
// ToastForm
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||||
|
this.ClientSize = new System.Drawing.Size(356, 122);
|
||||||
|
this.Controls.Add(this.labelMode);
|
||||||
|
this.Controls.Add(this.pictureIcon);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MdiChildrenMinimizedAnchorBottom = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
this.Name = "ToastForm";
|
||||||
|
this.ShowIcon = false;
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
|
this.Text = "ToastForm";
|
||||||
|
this.TopMost = true;
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureIcon)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureIcon;
|
||||||
|
private Label labelMode;
|
||||||
|
}
|
||||||
|
}
|
||||||
68
ToastForm.cs
Normal file
68
ToastForm.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
|
||||||
|
namespace GHelper
|
||||||
|
{
|
||||||
|
public partial class ToastForm : Form
|
||||||
|
{
|
||||||
|
|
||||||
|
private System.Windows.Forms.Timer timer = default!;
|
||||||
|
|
||||||
|
private const int SW_SHOWNOACTIVATE = 4;
|
||||||
|
private const int HWND_TOPMOST = -1;
|
||||||
|
private const uint SWP_NOACTIVATE = 0x0010;
|
||||||
|
|
||||||
|
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
|
||||||
|
static extern bool SetWindowPos(
|
||||||
|
int hWnd, // Window handle
|
||||||
|
int hWndInsertAfter, // Placement-order handle
|
||||||
|
int X, // Horizontal position
|
||||||
|
int Y, // Vertical position
|
||||||
|
int cx, // Width
|
||||||
|
int cy, // Height
|
||||||
|
uint uFlags); // Window positioning flags
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||||
|
|
||||||
|
static void ShowInactiveTopmost(Form frm)
|
||||||
|
{
|
||||||
|
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE);
|
||||||
|
SetWindowPos(frm.Handle.ToInt32(), HWND_TOPMOST,
|
||||||
|
frm.Left, frm.Top, frm.Width, frm.Height,
|
||||||
|
SWP_NOACTIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToastForm()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RunToast(string text)
|
||||||
|
{
|
||||||
|
|
||||||
|
Top = Screen.FromControl(this).WorkingArea.Height - this.Height - 100;
|
||||||
|
Left = (Screen.FromControl(this).Bounds.Width - this.Width) / 2;
|
||||||
|
|
||||||
|
ShowInactiveTopmost(this);
|
||||||
|
|
||||||
|
labelMode.Text = text;
|
||||||
|
|
||||||
|
timer = new System.Windows.Forms.Timer();
|
||||||
|
timer.Tick += new EventHandler(timer_Tick);
|
||||||
|
timer.Enabled = true;
|
||||||
|
timer.Interval = 1000;
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ToastForm_Show(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
ToastForm.resx
Normal file
60
ToastForm.resx
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 2.3 MiB |
Reference in New Issue
Block a user