mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
enhance: support save RepositoryNode changes instantly
This commit is contained in:
parent
28b6ce4993
commit
c85293c86a
3 changed files with 15 additions and 11 deletions
|
@ -75,6 +75,12 @@ namespace SourceGit
|
|||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
var pref = ViewModels.Preference.Instance;
|
||||
pref.PropertyChanged += (_1, _2) =>
|
||||
{
|
||||
#pragma warning disable CS4014
|
||||
pref.SaveAsync();
|
||||
#pragma warning restore CS4014
|
||||
};
|
||||
SetLocale(pref.Locale);
|
||||
SetTheme(pref.Theme, pref.ThemeOverrides);
|
||||
SetFonts(pref.DefaultFontFamily, pref.MonospaceFontFamily, pref.OnlyUseMonoFontInEditor);
|
||||
|
|
|
@ -356,6 +356,9 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return string.Compare(l.Name, r.Name, StringComparison.Ordinal);
|
||||
});
|
||||
#pragma warning disable CS4014
|
||||
SaveAsync();
|
||||
#pragma warning restore CS4014
|
||||
}
|
||||
|
||||
public RepositoryNode FindNode(string id)
|
||||
|
@ -400,6 +403,9 @@ namespace SourceGit.ViewModels
|
|||
public void RemoveNode(RepositoryNode node)
|
||||
{
|
||||
RemoveNodeRecursive(node, RepositoryNodes);
|
||||
#pragma warning disable CS4014
|
||||
SaveAsync();
|
||||
#pragma warning restore CS4014
|
||||
}
|
||||
|
||||
public void SortByRenamedNode(RepositoryNode node)
|
||||
|
@ -412,6 +418,9 @@ namespace SourceGit.ViewModels
|
|||
|
||||
return string.Compare(l.Name, r.Name, StringComparison.Ordinal);
|
||||
});
|
||||
#pragma warning disable CS4014
|
||||
SaveAsync();
|
||||
#pragma warning restore CS4014
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
@ -446,14 +455,6 @@ namespace SourceGit.ViewModels
|
|||
await File.WriteAllTextAsync(_savePath, data);
|
||||
}
|
||||
|
||||
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnPropertyChanged(e);
|
||||
#pragma warning disable CS4014
|
||||
SaveAsync();
|
||||
#pragma warning restore CS4014
|
||||
}
|
||||
|
||||
private RepositoryNode FindNodeRecursive(string id, List<RepositoryNode> collection)
|
||||
{
|
||||
foreach (var node in collection)
|
||||
|
|
|
@ -261,9 +261,6 @@ namespace SourceGit.Views
|
|||
if (sender is CheckBox box)
|
||||
{
|
||||
ViewModels.Preference.Instance.UseSystemWindowFrame = box.IsChecked == true;
|
||||
#pragma warning disable CS4014
|
||||
ViewModels.Preference.Instance.SaveAsync();
|
||||
#pragma warning restore CS4014
|
||||
|
||||
var dialog = new ConfirmRestart();
|
||||
App.OpenDialog(dialog);
|
||||
|
|
Loading…
Reference in a new issue