From 7b71f8512def9520a85b96da45b6023518a6cca5 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 5 Jun 2024 18:32:55 +0800 Subject: [PATCH] ux: re-arrange options in apperance page --- src/App.axaml.cs | 13 +----------- src/ViewModels/AddRemote.cs | 1 - src/Views/Preference.axaml | 42 ++++++++++++++++++------------------- 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 3dee174f..6d73bfab 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -132,14 +132,10 @@ namespace SourceGit var app = Current as App; var targetLocale = app.Resources[localeKey] as ResourceDictionary; if (targetLocale == null || targetLocale == app._activeLocale) - { return; - } if (app._activeLocale != null) - { app.Resources.MergedDictionaries.Remove(app._activeLocale); - } app.Resources.MergedDictionaries.Add(targetLocale); app._activeLocale = targetLocale; @@ -150,17 +146,11 @@ namespace SourceGit var app = Current as App; if (theme.Equals("Light", StringComparison.OrdinalIgnoreCase)) - { app.RequestedThemeVariant = ThemeVariant.Light; - } else if (theme.Equals("Dark", StringComparison.OrdinalIgnoreCase)) - { app.RequestedThemeVariant = ThemeVariant.Dark; - } else - { app.RequestedThemeVariant = ThemeVariant.Default; - } if (app._colorOverrides != null) { @@ -173,6 +163,7 @@ namespace SourceGit try { var resDic = new ResourceDictionary(); + var schema = JsonSerializer.Deserialize(File.ReadAllText(colorsFile), JsonCodeGen.Default.DictionaryStringString); foreach (var kv in schema) resDic[kv.Key] = Color.Parse(kv.Value); @@ -191,9 +182,7 @@ namespace SourceGit if (Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { if (desktop.MainWindow.Clipboard is { } clipbord) - { await clipbord.SetTextAsync(data); - } } } diff --git a/src/ViewModels/AddRemote.cs b/src/ViewModels/AddRemote.cs index 8386b755..296ddfdb 100644 --- a/src/ViewModels/AddRemote.cs +++ b/src/ViewModels/AddRemote.cs @@ -100,7 +100,6 @@ namespace SourceGit.ViewModels { SetProgressDescription("Fetching from added remote ..."); new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null); - new Commands.Fetch(_repo.FullPath, _name, true, SetProgressDescription).Exec(); } CallUIThread(() => diff --git a/src/Views/Preference.axaml b/src/Views/Preference.axaml index ce3e809b..d7bc08a6 100644 --- a/src/Views/Preference.axaml +++ b/src/Views/Preference.axaml @@ -161,27 +161,12 @@ Light - - - - - - - - - - - - - + + + + + + +