From 8c8c0a8c2b88e0a34815c3124a2103bc3573a4ab Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Fri, 30 Aug 2024 22:26:49 +0200 Subject: [PATCH] App: Try to fix auto context renewal --- Elwig/App.xaml.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index 8dc6160..160c5ef 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -53,7 +53,7 @@ namespace Elwig { public static Dispatcher MainDispatcher { get; private set; } private DateTime LastChanged; private static DateTime CurrentLastWrite => File.GetLastWriteTime(Config.DatabaseFile); - private readonly DispatcherTimer ContextTimer = new() { Interval = TimeSpan.FromSeconds(2) }; + private readonly DispatcherTimer ContextTimer = new() { Interval = TimeSpan.FromSeconds(5) }; public App() : base() { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); @@ -70,8 +70,9 @@ namespace Elwig { } ContextTimer.Tick += (object? sender, EventArgs evt) => { - if (CurrentLastWrite > LastChanged) { - LastChanged = CurrentLastWrite; + var ch = CurrentLastWrite; + if (ch > LastChanged) { + LastChanged = ch; OnContextChanged(); } };