diff --git a/PWM tool.zip b/PWM tool.zip index 68ea25e..412c944 100644 Binary files a/PWM tool.zip and b/PWM tool.zip differ diff --git a/PwmLib/PwmManager.cs b/PwmLib/PwmManager.cs index 0bab62d..a19e5b1 100644 --- a/PwmLib/PwmManager.cs +++ b/PwmLib/PwmManager.cs @@ -19,7 +19,7 @@ public bool FreqWatch { return _freqWatch; } - private set + set { _freqWatch = value; } @@ -81,7 +81,7 @@ public uint SetFrequency(int frequency) // Actually, I am in no way responsible for any damage of your device cause by this app, sorry :) if (frequency < 100 || frequency > 100000) { - OnError(frequency, $"Frequency {frequency} is not allowed. Frequency should be >= 200 and <= 2000."); + OnError(frequency, $"Frequency {frequency} is not allowed. Frequency should be >= 200 and <= 100000."); return 100500; } diff --git a/Wpf/App.xaml.cs b/Wpf/App.xaml.cs index 2a80938..ce211e3 100644 --- a/Wpf/App.xaml.cs +++ b/Wpf/App.xaml.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using NotifyIcon = System.Windows.Forms.NotifyIcon; using PwmLib; +using System.Windows.Threading; namespace Wpf { @@ -55,6 +56,16 @@ protected override void OnStartup(StartupEventArgs e) // by some reason _pwm.SetFrequency doesn't work if called from a background thread // _pwm.LookAfterFreq(); CheckLastFrequency(); + + var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) }; + timer.Tick += OnTimedEvent; + timer.Start(); + _pwm.FreqWatch= true; + } + + private void OnTimedEvent(object sender, EventArgs e) + { + CheckLastFrequency(); } private void CheckLastFrequency() @@ -130,6 +141,7 @@ private void setFreq_Click(object sender, EventArgs e) } _mainWindow.Show(); + _mainWindow.Focus(); } } }