UI tweaks

This commit is contained in:
seerge
2023-04-08 13:45:27 +02:00
parent 9d2b8b506e
commit e11027963f
4 changed files with 51 additions and 17 deletions

View File

@@ -3,6 +3,7 @@ using System.Data;
using System.Diagnostics; using System.Diagnostics;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox; using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
using System.Security.Policy; using System.Security.Policy;
using HidSharp.Utility;
namespace GHelper namespace GHelper
{ {
@@ -57,7 +58,7 @@ namespace GHelper
static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0, 0, 0 }; static byte[] MESSAGE_SET = { 0x5d, 0xb5, 0, 0, 0 };
static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 }; static byte[] MESSAGE_APPLY = { 0x5d, 0xb4 };
static int[] deviceIds = { 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0 }; static int[] deviceIds = { 0x1a30, 0x1854, 0x1869, 0x1866, 0x19b6, 0x1822, 0x1837, 0x1854, 0x184a, 0x183d, 0x8502, 0x1807, 0x17e0 };
private static int mode = 0; private static int mode = 0;
private static int speed = 1; private static int speed = 1;
@@ -197,6 +198,7 @@ namespace GHelper
device.CloseDevice(); device.CloseDevice();
} }
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
} }
@@ -223,6 +225,8 @@ namespace GHelper
device.CloseDevice(); device.CloseDevice();
} }
Logger.WriteLine("USB-KB = " + BitConverter.ToString(msg));
if (Program.config.ContainsModel("TUF")) if (Program.config.ContainsModel("TUF"))
Program.wmi.TUFKeyboardPower(awake, boot, sleep, shutdown); Program.wmi.TUFKeyboardPower(awake, boot, sleep, shutdown);

View File

@@ -16,7 +16,23 @@
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly> <ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<AssemblyVersion>0.48</AssemblyVersion> <AssemblyVersion>0.49</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -826,7 +826,7 @@ namespace GHelper
buttonMiniled.Secondary = false; buttonMiniled.Secondary = false;
buttonMiniled.Size = new Size(185, 72); buttonMiniled.Size = new Size(185, 72);
buttonMiniled.TabIndex = 3; buttonMiniled.TabIndex = 3;
buttonMiniled.Text = "Miniled"; buttonMiniled.Text = "Multizone";
buttonMiniled.UseVisualStyleBackColor = false; buttonMiniled.UseVisualStyleBackColor = false;
// //
// pictureScreen // pictureScreen

View File

@@ -185,13 +185,13 @@ namespace GHelper
private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e) private static void TrayIcon_MouseMove(object? sender, MouseEventArgs e)
{ {
RefreshSensors(); Program.settingsForm.RefreshSensors();
} }
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e) private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
{ {
RefreshSensors(); Program.settingsForm.RefreshSensors();
} }
private void Button120Hz_MouseHover(object? sender, EventArgs e) private void Button120Hz_MouseHover(object? sender, EventArgs e)
@@ -795,7 +795,7 @@ namespace GHelper
} }
private static void RefreshSensors(bool force = false) private void RefreshSensors(bool force = false)
{ {
if (!force && Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastRefresh) < 2000) return; if (!force && Math.Abs(DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastRefresh) < 2000) return;
@@ -820,18 +820,19 @@ namespace GHelper
Program.settingsForm.BeginInvoke(delegate Program.settingsForm.BeginInvoke(delegate
{ {
Program.settingsForm.labelCPUFan.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan; labelCPUFan.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan;
Program.settingsForm.labelGPUFan.Text = "GPU" + gpuTemp + HardwareMonitor.gpuFan; labelGPUFan.Text = "GPU" + gpuTemp + HardwareMonitor.gpuFan;
if (HardwareMonitor.midFan is not null) if (HardwareMonitor.midFan is not null)
Program.settingsForm.labelMidFan.Text = "Mid" + HardwareMonitor.midFan; labelMidFan.Text = "Mid" + HardwareMonitor.midFan;
Program.settingsForm.labelBattery.Text = battery;
Program.trayIcon.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan + "\n"
+ "GPU" + gpuTemp + HardwareMonitor.gpuFan +
((battery.Length > 0) ? ("\n" + battery) : "");
labelBattery.Text = battery;
}); });
Program.trayIcon.Text = "CPU" + cpuTemp + HardwareMonitor.cpuFan + "\n"
+ "GPU" + gpuTemp + HardwareMonitor.gpuFan +
((battery.Length > 0) ? ("\n" + battery) : "");
} }
@@ -858,6 +859,8 @@ namespace GHelper
int limit_total = Program.config.getConfigPerf("limit_total"); int limit_total = Program.config.getConfigPerf("limit_total");
int limit_cpu = Program.config.getConfigPerf("limit_cpu"); int limit_cpu = Program.config.getConfigPerf("limit_cpu");
string limitLabel = null;
if (limit_total > ASUSWmi.MaxTotal) return; if (limit_total > ASUSWmi.MaxTotal) return;
if (limit_total < ASUSWmi.MinTotal) return; if (limit_total < ASUSWmi.MinTotal) return;
@@ -865,10 +868,21 @@ namespace GHelper
if (limit_cpu < ASUSWmi.MinCPU) return; if (limit_cpu < ASUSWmi.MinCPU) return;
if (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0) if (Program.wmi.DeviceGet(ASUSWmi.PPT_TotalA0) >= 0)
{
Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total, "PowerLimit A"); Program.wmi.DeviceSet(ASUSWmi.PPT_TotalA0, limit_total, "PowerLimit A");
limitLabel = limit_total + "W";
}
if (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0) if (Program.wmi.DeviceGet(ASUSWmi.PPT_CPUB0) >= 0)
{
Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu, "PowerLimit B"); Program.wmi.DeviceSet(ASUSWmi.PPT_CPUB0, limit_cpu, "PowerLimit B");
limitLabel = limit_cpu + "W";
}
Program.settingsForm.BeginInvoke(delegate
{
labelPerf.Text = "Performance Mode+ " + limitLabel;
});
} }
@@ -1007,10 +1021,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);
} }