mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
code_review: PR #120
* remove unnecessary code. The `SetProperty` function takes care of set same property in a loop
This commit is contained in:
@@ -134,11 +134,14 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
if (commits.Count == 0)
|
||||
{
|
||||
_repo.SearchResultSelectedCommit = null;
|
||||
DetailContext = null;
|
||||
}
|
||||
else if (commits.Count == 1)
|
||||
{
|
||||
var commit = commits[0] as Models.Commit;
|
||||
_repo.SearchResultSelectedCommit = commit;
|
||||
|
||||
AutoSelectedCommit = commit;
|
||||
NavigationId = _navigationId + 1;
|
||||
|
||||
@@ -155,12 +158,15 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
else if (commits.Count == 2)
|
||||
{
|
||||
_repo.SearchResultSelectedCommit = null;
|
||||
|
||||
var end = commits[0] as Models.Commit;
|
||||
var start = commits[1] as Models.Commit;
|
||||
DetailContext = new RevisionCompare(_repo.FullPath, start, end);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repo.SearchResultSelectedCommit = null;
|
||||
DetailContext = new CountSelectedCommits() { Count = commits.Count };
|
||||
}
|
||||
}
|
||||
@@ -369,18 +375,6 @@ namespace SourceGit.ViewModels
|
||||
return menu;
|
||||
}
|
||||
|
||||
public void NotifyAutoSelectedCommitChanged()
|
||||
{
|
||||
if (DetailContext is CommitDetail detail)
|
||||
{
|
||||
_repo.HandleSelectedCommitChanged(detail.Commit);
|
||||
}
|
||||
else
|
||||
{
|
||||
_repo.HandleSelectedCommitChanged(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void FillCurrentBranchMenu(ContextMenu menu, Models.Branch current)
|
||||
{
|
||||
var submenu = new MenuItem();
|
||||
|
||||
@@ -1354,14 +1354,6 @@ namespace SourceGit.ViewModels
|
||||
return menu;
|
||||
}
|
||||
|
||||
public void HandleSelectedCommitChanged(Models.Commit commit)
|
||||
{
|
||||
if (SearchedCommits.Count > 0)
|
||||
{
|
||||
SearchResultSelectedCommit = commit;
|
||||
}
|
||||
}
|
||||
|
||||
private string _fullpath = string.Empty;
|
||||
private string _gitDir = string.Empty;
|
||||
private Models.GitFlow _gitflow = new Models.GitFlow();
|
||||
|
||||
@@ -291,7 +291,6 @@ namespace SourceGit.Views
|
||||
if (DataContext is ViewModels.Histories histories)
|
||||
{
|
||||
histories.Select(commitDataGrid.SelectedItems);
|
||||
histories.NotifyAutoSelectedCommitChanged();
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user