mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Minor fixes
This commit is contained in:
@@ -294,11 +294,17 @@ public class ASUSWmi
|
|||||||
|
|
||||||
public void SubscribeToEvents(Action<object, EventArrivedEventArgs> EventHandler)
|
public void SubscribeToEvents(Action<object, EventArrivedEventArgs> EventHandler)
|
||||||
{
|
{
|
||||||
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
try
|
||||||
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
{
|
||||||
watcher.Scope = new ManagementScope("root\\wmi");
|
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
||||||
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
watcher.EventArrived += new EventArrivedEventHandler(EventHandler);
|
||||||
watcher.Start();
|
watcher.Scope = new ManagementScope("root\\wmi");
|
||||||
|
watcher.Query = new WqlEventQuery("SELECT * FROM AsusAtkWmiEvent");
|
||||||
|
watcher.Start();
|
||||||
|
} catch
|
||||||
|
{
|
||||||
|
Logger.WriteLine("Can't connect to ASUS WMI events");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace GHelper
|
|||||||
|
|
||||||
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
|
chart.ChartAreas[0].AxisY.LabelStyle.Font = new Font("Arial", 7F);
|
||||||
|
|
||||||
var foreAccent = Color.FromArgb(255, 100, 100, 100);
|
var foreAccent = Color.FromArgb(255, 180, 180, 180);
|
||||||
|
|
||||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
|
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = foreAccent;
|
||||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
|
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = foreAccent;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<PlatformTarget>x64</PlatformTarget>
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<AssemblyVersion>0.45</AssemblyVersion>
|
<AssemblyVersion>0.46</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<PackageReference Include="NvAPIWrapper.Net" Version="0.8.1.101" />
|
<PackageReference Include="NvAPIWrapper.Net" Version="0.8.1.101" />
|
||||||
<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" />
|
||||||
<PackageReference Include="WinForms.DataVisualization" Version="1.7.0" />
|
<PackageReference Include="WinForms.DataVisualization" Version="1.8.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public static class HardwareMonitor
|
|||||||
Logger.WriteLine(ex.ToString());
|
Logger.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpuTemp < 0)
|
if (gpuTemp is null || gpuTemp < 0)
|
||||||
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
gpuTemp = Program.wmi.DeviceGet(ASUSWmi.Temp_GPU);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ namespace GHelper
|
|||||||
bool switched = settingsForm.AutoGPUMode();
|
bool switched = settingsForm.AutoGPUMode();
|
||||||
if (!switched) settingsForm.AutoScreen();
|
if (!switched) settingsForm.AutoScreen();
|
||||||
|
|
||||||
|
settingsForm.AutoKeyboard();
|
||||||
settingsForm.SetMatrix();
|
settingsForm.SetMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +140,6 @@ namespace GHelper
|
|||||||
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
|
if (SystemInformation.PowerStatus.PowerLineStatus == isPlugged) return;
|
||||||
|
|
||||||
Logger.WriteLine("Windows - Power Mode Changed");
|
Logger.WriteLine("Windows - Power Mode Changed");
|
||||||
settingsForm.AutoKeyboard();
|
|
||||||
SetAutoModes();
|
SetAutoModes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1011,10 +1011,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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,31 +22,43 @@ public class Startup
|
|||||||
|
|
||||||
var userId = WindowsIdentity.GetCurrent().Name;
|
var userId = WindowsIdentity.GetCurrent().Name;
|
||||||
|
|
||||||
TaskDefinition td = TaskService.Instance.NewTask();
|
using (TaskDefinition td = TaskService.Instance.NewTask())
|
||||||
td.RegistrationInfo.Description = "GHelper Auto Start";
|
|
||||||
td.Triggers.Add(new LogonTrigger { UserId = userId });
|
|
||||||
td.Actions.Add(strExeFilePath);
|
|
||||||
|
|
||||||
td.Settings.StopIfGoingOnBatteries = false;
|
|
||||||
td.Settings.DisallowStartIfOnBatteries = false;
|
|
||||||
td.Settings.ExecutionTimeLimit = TimeSpan.Zero;
|
|
||||||
|
|
||||||
Debug.WriteLine(strExeFilePath);
|
|
||||||
Debug.WriteLine(userId);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, td);
|
td.RegistrationInfo.Description = "G-Helper Auto Start";
|
||||||
} catch (Exception e)
|
td.Triggers.Add(new LogonTrigger { UserId = userId });
|
||||||
{
|
td.Actions.Add(strExeFilePath);
|
||||||
MessageBox.Show(e.ToString(), "Scheduler Error", MessageBoxButtons.OK);
|
|
||||||
|
td.Settings.StopIfGoingOnBatteries = false;
|
||||||
|
td.Settings.DisallowStartIfOnBatteries = false;
|
||||||
|
td.Settings.ExecutionTimeLimit = TimeSpan.Zero;
|
||||||
|
|
||||||
|
Debug.WriteLine(strExeFilePath);
|
||||||
|
Debug.WriteLine(userId);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TaskService.Instance.RootFolder.RegisterTaskDefinition(taskName, td);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Can't create a start up task. Try running Task Scheduler by hand and manually deleting GHelper task if it exists there.", "Scheduler Error", MessageBoxButtons.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnSchedule()
|
public static void UnSchedule()
|
||||||
{
|
{
|
||||||
TaskService taskService = new TaskService();
|
using (TaskService taskService = new TaskService())
|
||||||
taskService.RootFolder.DeleteTask(taskName);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
taskService.RootFolder.DeleteTask(taskName);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Can't remove task. Try running Task Scheduler by hand and manually deleting GHelper task if it exists there.", "Scheduler Error", MessageBoxButtons.OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user