mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
fix: try to fix issue #338
* upgrade Avalonia to `11.1.3` * use reactive property instead of simple getter
This commit is contained in:
parent
34a598d421
commit
f3406e93fc
5 changed files with 30 additions and 23 deletions
|
@ -142,14 +142,16 @@ namespace SourceGit.ViewModels
|
|||
private set => SetProperty(ref _submodules, value);
|
||||
}
|
||||
|
||||
public int WorkingCopyChangesCount
|
||||
public int LocalChangesCount
|
||||
{
|
||||
get => _workingCopy == null ? 0 : _workingCopy.Count;
|
||||
get => _localChangesCount;
|
||||
private set => SetProperty(ref _localChangesCount, value);
|
||||
}
|
||||
|
||||
public int StashesCount
|
||||
{
|
||||
get => _stashesPage == null ? 0 : _stashesPage.Stashes.Count;
|
||||
get => _stashesCount;
|
||||
private set => SetProperty(ref _stashesCount, value);
|
||||
}
|
||||
|
||||
public bool IncludeUntracked
|
||||
|
@ -350,6 +352,9 @@ namespace SourceGit.ViewModels
|
|||
_stashesPage = null;
|
||||
_inProgressContext = null;
|
||||
|
||||
_localChangesCount = 0;
|
||||
_stashesCount = 0;
|
||||
|
||||
_remotes.Clear();
|
||||
_branches.Clear();
|
||||
_localBranchTrees.Clear();
|
||||
|
@ -834,7 +839,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
InProgressContext = inProgress;
|
||||
HasUnsolvedConflicts = hasUnsolvedConflict;
|
||||
OnPropertyChanged(nameof(WorkingCopyChangesCount));
|
||||
LocalChangesCount = changes.Count;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -845,7 +850,8 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
if (_stashesPage != null)
|
||||
_stashesPage.Stashes = stashes;
|
||||
OnPropertyChanged(nameof(StashesCount));
|
||||
|
||||
StashesCount = stashes.Count;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -878,7 +884,7 @@ namespace SourceGit.ViewModels
|
|||
|
||||
if (branch.IsLocal)
|
||||
{
|
||||
if (WorkingCopyChangesCount > 0)
|
||||
if (_localChangesCount > 0)
|
||||
PopupHost.ShowPopup(new Checkout(this, branch.Name));
|
||||
else
|
||||
PopupHost.ShowAndStartPopup(new Checkout(this, branch.Name));
|
||||
|
@ -1215,7 +1221,7 @@ namespace SourceGit.ViewModels
|
|||
var discard = new MenuItem();
|
||||
discard.Header = App.Text("BranchCM.DiscardAll");
|
||||
discard.Icon = App.CreateMenuIcon("Icons.Undo");
|
||||
discard.IsEnabled = _workingCopy.Count > 0;
|
||||
discard.IsEnabled = _localChangesCount > 0;
|
||||
discard.Click += (_, e) =>
|
||||
{
|
||||
if (PopupHost.CanCreatePopup())
|
||||
|
@ -1319,7 +1325,7 @@ namespace SourceGit.ViewModels
|
|||
menu.Items.Add(merge);
|
||||
menu.Items.Add(rebase);
|
||||
|
||||
if (WorkingCopyChangesCount > 0)
|
||||
if (_localChangesCount > 0)
|
||||
{
|
||||
var compareWithWorktree = new MenuItem();
|
||||
compareWithWorktree.Header = App.Text("BranchCM.CompareWithWorktree");
|
||||
|
@ -1342,7 +1348,7 @@ namespace SourceGit.ViewModels
|
|||
var compareWithBranch = CreateMenuItemToCompareBranches(branch);
|
||||
if (compareWithBranch != null)
|
||||
{
|
||||
if (WorkingCopyChangesCount == 0)
|
||||
if (_localChangesCount == 0)
|
||||
menu.Items.Add(new MenuItem() { Header = "-" });
|
||||
|
||||
menu.Items.Add(compareWithBranch);
|
||||
|
@ -1619,7 +1625,7 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
|
||||
var hasCompare = false;
|
||||
if (WorkingCopyChangesCount > 0)
|
||||
if (_localChangesCount > 0)
|
||||
{
|
||||
var compareWithWorktree = new MenuItem();
|
||||
compareWithWorktree.Header = App.Text("BranchCM.CompareWithWorktree");
|
||||
|
@ -1981,6 +1987,9 @@ namespace SourceGit.ViewModels
|
|||
private int _selectedViewIndex = 0;
|
||||
private object _selectedView = null;
|
||||
|
||||
private int _localChangesCount = 0;
|
||||
private int _stashesCount = 0;
|
||||
|
||||
private bool _isSearching = false;
|
||||
private bool _isSearchLoadingVisible = false;
|
||||
private bool _isSearchCommitSuggestionOpen = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue