Updated App
Added resetting of SettingsDirty when we ResetSettings(), SaveSettings(), and first load in Settings. Added more noise to know what is going on.
This commit is contained in:
parent
433797caae
commit
08f5038abd
1 changed files with 16 additions and 0 deletions
|
|
@ -98,6 +98,7 @@ public partial class App : Application
|
|||
_settings.SyncProfile = @new.SyncProfile;
|
||||
_settings.SyncSearchHistory = @new.SyncSearchHistory;
|
||||
_settings.SyncSettings = @new.SyncSettings;
|
||||
_settings.SettingsDirty = false;
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
|
|
@ -110,6 +111,7 @@ public partial class App : Application
|
|||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
File.WriteAllText(path, JsonSerializer.Serialize(_settings));
|
||||
_settings!.SettingsDirty = false;
|
||||
SettingsChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
|
@ -131,15 +133,23 @@ public partial class App : Application
|
|||
|
||||
private async Task SyncMonitor()
|
||||
{
|
||||
// TODO: Replace with Logger
|
||||
Console.WriteLine("Sync Monitor Starting Up.");
|
||||
// TODO: Replace with Logger
|
||||
Console.WriteLine("Starting API Validation Check.");
|
||||
while (_isRunning)
|
||||
{
|
||||
await _semaphoreSlim.WaitAsync();
|
||||
|
||||
if (!await _syncers![0].PingApi())
|
||||
{
|
||||
_semaphoreSlim.Release();
|
||||
await Task.Delay(5000);
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Replace with Logger
|
||||
Console.WriteLine("Fetching initial data from Database.");
|
||||
foreach (var syncer in _syncers!)
|
||||
{
|
||||
await syncer.FetchDatabase();
|
||||
|
|
@ -149,6 +159,8 @@ public partial class App : Application
|
|||
break;
|
||||
}
|
||||
|
||||
// TODO: Replace with Logger
|
||||
Console.WriteLine("Starting Filesystem Sync Monitoring.");
|
||||
var lastCheck = DateTime.Now;
|
||||
while (_isRunning)
|
||||
{
|
||||
|
|
@ -188,6 +200,9 @@ public partial class App : Application
|
|||
// TODO: Replace with Logger
|
||||
Console.WriteLine($"Sync completed in {syncEnd}.");
|
||||
}
|
||||
|
||||
// TODO: Replace with Logger
|
||||
Console.WriteLine($"Filesystem Sync Monitor Shutdown.");
|
||||
}
|
||||
|
||||
private async void HandleSettingsChanged(object? sender, EventArgs e)
|
||||
|
|
@ -218,6 +233,7 @@ public partial class App : Application
|
|||
{
|
||||
DataContext = _settings
|
||||
};
|
||||
_settings!.SettingsDirty = false;
|
||||
}
|
||||
StampSettings();
|
||||
desktop.MainWindow!.Show();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue