Sensor refresh timers

This commit is contained in:
seerge
2023-02-21 21:54:13 +01:00
parent 6d142213c8
commit 1f4afedc1d
3 changed files with 11 additions and 9 deletions

View File

@@ -1,11 +1,10 @@
using HidLibrary;
using LibreHardwareMonitor.Hardware;
using Microsoft.Win32.TaskScheduler;
using System.Diagnostics;
using System.Management;
using System.Runtime.InteropServices;
using HidLibrary;
using System.Text.Json;
using LibreHardwareMonitor.Hardware;
using System.Threading;
public class ASUSWmi
{
@@ -232,7 +231,7 @@ public class NativeMethods
[MarshalAs(UnmanagedType.LPStruct)] Guid SubGroupOfPowerSettingsGuid,
[MarshalAs(UnmanagedType.LPStruct)] Guid PowerSettingGuid,
int AcValueIndex);
[DllImport("PowrProf.dll", CharSet = CharSet.Unicode)]
static extern UInt32 PowerReadACValueIndex(IntPtr RootPowerKey,
[MarshalAs(UnmanagedType.LPStruct)] Guid SchemeGuid,
@@ -550,7 +549,7 @@ public class HardwareMonitor
public void ReadSensors()
{
computer.Open();
computer.Accept(new UpdateVisitor());

5
Settings.Designer.cs generated
View File

@@ -473,6 +473,7 @@
"Strobe",
"Rainbow"});
this.comboKeyboard.Location = new System.Drawing.Point(38, 778);
this.comboKeyboard.Margin = new System.Windows.Forms.Padding(0);
this.comboKeyboard.Name = "comboKeyboard";
this.comboKeyboard.Size = new System.Drawing.Size(200, 40);
this.comboKeyboard.TabIndex = 24;
@@ -482,7 +483,7 @@
//
this.buttonKeyboardColor.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.buttonKeyboardColor.FlatAppearance.BorderColor = System.Drawing.Color.Red;
this.buttonKeyboardColor.FlatAppearance.BorderSize = 4;
this.buttonKeyboardColor.FlatAppearance.BorderSize = 3;
this.buttonKeyboardColor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonKeyboardColor.ForeColor = System.Drawing.SystemColors.ControlText;
this.buttonKeyboardColor.Location = new System.Drawing.Point(261, 773);
@@ -517,7 +518,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(13F, 32F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(744, 1085);
this.ClientSize = new System.Drawing.Size(744, 1093);
this.Controls.Add(this.labelBattery);
this.Controls.Add(this.buttonKeyboardColor);
this.Controls.Add(this.comboKeyboard);

View File

@@ -294,9 +294,10 @@ namespace GHelper
private static void SetTimer()
{
aTimer = new System.Timers.Timer(2000);
aTimer = new System.Timers.Timer(500);
aTimer.Elapsed += OnTimedEvent;
aTimer.AutoReset = true;
aTimer.Enabled = false;
}
private static void RefreshSensors()
@@ -340,6 +341,7 @@ namespace GHelper
private static void OnTimedEvent(Object? source, ElapsedEventArgs? e)
{
RefreshSensors();
aTimer.Interval = 2000;
}
private void SettingsForm_VisibleChanged(object? sender, EventArgs e)
@@ -352,7 +354,7 @@ namespace GHelper
this.Top = Screen.FromControl(this).WorkingArea.Height - 10 - this.Height;
this.Activate();
//RefreshSensors();
aTimer.Interval = 500;
aTimer.Enabled = true;
}