From e2b9dfc247cd8a47ce3017aa28da11268007c2d4 Mon Sep 17 00:00:00 2001 From: Jan Sandbrink Date: Sun, 6 Jul 2014 21:42:01 +0200 Subject: [PATCH] allow to force refreshing the hard-drive --- DriveKeepAlive/MainWindow.xaml | 5 +++-- DriveKeepAlive/MainWindow.xaml.cs | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/DriveKeepAlive/MainWindow.xaml b/DriveKeepAlive/MainWindow.xaml index 7e56e07..98aa86c 100644 --- a/DriveKeepAlive/MainWindow.xaml +++ b/DriveKeepAlive/MainWindow.xaml @@ -1,15 +1,16 @@  + Title="Drive Keep-alive" Height="152.672" Width="525" Closed="Window_Closed_1" ResizeMode="CanMinimize"> + - + diff --git a/DriveKeepAlive/MainWindow.xaml.cs b/DriveKeepAlive/MainWindow.xaml.cs index e8c841d..d69b246 100644 --- a/DriveKeepAlive/MainWindow.xaml.cs +++ b/DriveKeepAlive/MainWindow.xaml.cs @@ -22,6 +22,7 @@ namespace DriveKeepAlive /// public partial class MainWindow : Window { + private bool ForceRefresh; private Stream FileStream; private AppSettings Config = AppSettings.Default; @@ -44,7 +45,7 @@ private void KeepAliveCycle() long idleCount = 0; while (true) { - if (IsUserActive()) + if (IsUserActive() || ForceRefresh) { WriteToKeepAliveFile(); UpdateStatusText(++writeCount, idleCount); @@ -96,5 +97,10 @@ private void Window_Closed_1(object sender, EventArgs e) { FileStream.Close(); } + + private void forceRefreshCheckBox_Checked(object sender, RoutedEventArgs e) + { + ForceRefresh = forceRefreshCheckBox.IsChecked.Value; + } } }