fix: do not save preference in design mode

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-03-11 11:41:37 +08:00
parent 54d49a9eda
commit f23e3478e6
No known key found for this signature in database
5 changed files with 14 additions and 5 deletions

View file

@ -169,6 +169,11 @@ namespace SourceGit.Views
protected override void OnClosing(WindowClosingEventArgs e)
{
base.OnClosing(e);
if (Design.IsDesignMode)
return;
var config = new Commands.Config(null).ListAll();
SetIfChanged(config, "user.name", DefaultUser, "");
SetIfChanged(config, "user.email", DefaultEmail, "");
@ -199,7 +204,6 @@ namespace SourceGit.Views
}
ViewModels.Preferences.Instance.Save();
base.OnClosing(e);
}
private async void SelectThemeOverrideFile(object _, RoutedEventArgs e)