App: Try to fix auto context renewal
All checks were successful
Test / Run tests (push) Successful in 2m23s
All checks were successful
Test / Run tests (push) Successful in 2m23s
This commit is contained in:
@ -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();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user