mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
fix: do not save preference in design mode
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
54d49a9eda
commit
f23e3478e6
5 changed files with 14 additions and 5 deletions
|
@ -11,8 +11,10 @@ namespace SourceGit.Views
|
|||
|
||||
protected override void OnClosing(WindowClosingEventArgs e)
|
||||
{
|
||||
ViewModels.Preferences.Instance.Save();
|
||||
base.OnClosing(e);
|
||||
|
||||
if (!Design.IsDesignMode)
|
||||
ViewModels.Preferences.Instance.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -273,8 +273,10 @@ namespace SourceGit.Views
|
|||
|
||||
protected override void OnClosing(WindowClosingEventArgs e)
|
||||
{
|
||||
(DataContext as ViewModels.Launcher)?.Quit(Width, Height);
|
||||
base.OnClosing(e);
|
||||
|
||||
if (!Design.IsDesignMode && DataContext is ViewModels.Launcher launcher)
|
||||
launcher.Quit(Width, Height);
|
||||
}
|
||||
|
||||
private void OnOpenWorkspaceMenu(object sender, RoutedEventArgs e)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -13,8 +13,10 @@ namespace SourceGit.Views
|
|||
|
||||
protected override void OnClosing(WindowClosingEventArgs e)
|
||||
{
|
||||
(DataContext as ViewModels.RepositoryConfigure)?.Save();
|
||||
base.OnClosing(e);
|
||||
|
||||
if (!Design.IsDesignMode && DataContext is ViewModels.RepositoryConfigure configure)
|
||||
configure.Save();
|
||||
}
|
||||
|
||||
private async void SelectExecutableForCustomAction(object sender, RoutedEventArgs e)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue