code_review: PR #436

It's ok to call `Save()` multiple times after property of `ViewModels.Preference` changed immediately. If we delay the saving operation 3 seconds after the property changed event, we reduce the times calling `Save`, but the issue metioned in #436 may still exists.
This commit is contained in:
leo 2024-09-02 12:20:11 +08:00
parent 9ee9f921f4
commit 9fe8ffcea9
No known key found for this signature in database
2 changed files with 18 additions and 54 deletions

View file

@ -75,12 +75,8 @@ namespace SourceGit
AvaloniaXamlLoader.Load(this);
var pref = ViewModels.Preference.Instance;
pref.PropertyChanged += (_1, _2) =>
{
#pragma warning disable CS4014
pref.SaveAsync();
#pragma warning restore CS4014
};
pref.PropertyChanged += (_1, _2) => pref.Save();
SetLocale(pref.Locale);
SetTheme(pref.Theme, pref.ThemeOverrides);
SetFonts(pref.DefaultFontFamily, pref.MonospaceFontFamily, pref.OnlyUseMonoFontInEditor);
@ -527,9 +523,7 @@ namespace SourceGit
var pref = ViewModels.Preference.Instance;
if (pref.ShouldCheck4UpdateOnStartup())
{
Check4Update();
}
}
private ViewModels.Launcher _launcher = null;