From 4f93a21098d6a7905c71b0b9f834febe3a0dda16 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Sat, 9 Aug 2025 04:11:25 -0500 Subject: [PATCH] Updated UI/App Settings Changed interval check from a Numeric spin box, to a pre-defined option selector. Now have 1/2 minute, 1 Minute, 30 Minutes, 1 hour, 6 hours, 12 hours and 24 hour intervals. --- FreeTubeSyncer/App.axaml.cs | 3 +++ FreeTubeSyncer/MainWindow.axaml | 8 +++++++- FreeTubeSyncer/Models/AppSetting.cs | 26 +++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/FreeTubeSyncer/App.axaml.cs b/FreeTubeSyncer/App.axaml.cs index 68ad15a..72c7439 100644 --- a/FreeTubeSyncer/App.axaml.cs +++ b/FreeTubeSyncer/App.axaml.cs @@ -125,6 +125,7 @@ public partial class App : Application _settings.SyncSearchHistory = @new.SyncSearchHistory; _settings.SyncSettings = @new.SyncSettings; _settings.SettingsDirty = false; + _settings.UpdateInterval(); } public void SaveSettings() @@ -146,11 +147,13 @@ public partial class App : Application if (!File.Exists(path)) { _settings = new AppSettings(); + _settings.UpdateInterval(); return; } var data = File.ReadAllText(path); _settings = JsonSerializer.Deserialize(data); + _settings!.UpdateInterval(); } private string GetAppFolder() => Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FreeTubeSyncer"); diff --git a/FreeTubeSyncer/MainWindow.axaml b/FreeTubeSyncer/MainWindow.axaml index 8ee3fa1..7efbfa5 100644 --- a/FreeTubeSyncer/MainWindow.axaml +++ b/FreeTubeSyncer/MainWindow.axaml @@ -24,7 +24,13 @@ - + + + + + + + _checkIntervalOptions = [ + new CheckIntervalOption("1/2 Minute", 30), + new CheckIntervalOption("1 Minute", 60), + new CheckIntervalOption("30 Minutes", 1800), + new CheckIntervalOption("1 Hour", 3600), + new CheckIntervalOption("6 Hours", 21600), + new CheckIntervalOption("12 Hours", 43200), + new CheckIntervalOption("24 Hours", 86400), + ]; public AppSettings() { @@ -21,7 +33,19 @@ public partial class AppSettings : ObservableObject if (args.PropertyName == nameof(SettingsDirty)) return; + if (args.PropertyName == nameof(SelectedOption)) + _checkInterval = SelectedOption?.Interval ?? 30; + SettingsDirty = true; }; } -} \ No newline at end of file + + public void UpdateInterval() + { + int[] intervals = [30, 60, 1800, 3600, 21600, 43200, 86400]; + var i = intervals.IndexOf(CheckInterval); + SelectedOption = CheckIntervalOptions[i]; + } +} + +public record CheckIntervalOption(string Label, int Interval); \ No newline at end of file