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; }
|
public static Dispatcher MainDispatcher { get; private set; }
|
||||||
private DateTime LastChanged;
|
private DateTime LastChanged;
|
||||||
private static DateTime CurrentLastWrite => File.GetLastWriteTime(Config.DatabaseFile);
|
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() {
|
public App() : base() {
|
||||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
@ -70,8 +70,9 @@ namespace Elwig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContextTimer.Tick += (object? sender, EventArgs evt) => {
|
ContextTimer.Tick += (object? sender, EventArgs evt) => {
|
||||||
if (CurrentLastWrite > LastChanged) {
|
var ch = CurrentLastWrite;
|
||||||
LastChanged = CurrentLastWrite;
|
if (ch > LastChanged) {
|
||||||
|
LastChanged = ch;
|
||||||
OnContextChanged();
|
OnContextChanged();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user