mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 22:01:10 +08:00
enhance: support save RepositoryNode changes instantly
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user