mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -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:
parent
efd8e72c4e
commit
764cf24284
3 changed files with 6 additions and 21 deletions
|
@ -134,11 +134,14 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
if (commits.Count == 0)
|
if (commits.Count == 0)
|
||||||
{
|
{
|
||||||
|
_repo.SearchResultSelectedCommit = null;
|
||||||
DetailContext = null;
|
DetailContext = null;
|
||||||
}
|
}
|
||||||
else if (commits.Count == 1)
|
else if (commits.Count == 1)
|
||||||
{
|
{
|
||||||
var commit = commits[0] as Models.Commit;
|
var commit = commits[0] as Models.Commit;
|
||||||
|
_repo.SearchResultSelectedCommit = commit;
|
||||||
|
|
||||||
AutoSelectedCommit = commit;
|
AutoSelectedCommit = commit;
|
||||||
NavigationId = _navigationId + 1;
|
NavigationId = _navigationId + 1;
|
||||||
|
|
||||||
|
@ -155,12 +158,15 @@ namespace SourceGit.ViewModels
|
||||||
}
|
}
|
||||||
else if (commits.Count == 2)
|
else if (commits.Count == 2)
|
||||||
{
|
{
|
||||||
|
_repo.SearchResultSelectedCommit = null;
|
||||||
|
|
||||||
var end = commits[0] as Models.Commit;
|
var end = commits[0] as Models.Commit;
|
||||||
var start = commits[1] as Models.Commit;
|
var start = commits[1] as Models.Commit;
|
||||||
DetailContext = new RevisionCompare(_repo.FullPath, start, end);
|
DetailContext = new RevisionCompare(_repo.FullPath, start, end);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_repo.SearchResultSelectedCommit = null;
|
||||||
DetailContext = new CountSelectedCommits() { Count = commits.Count };
|
DetailContext = new CountSelectedCommits() { Count = commits.Count };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,18 +375,6 @@ namespace SourceGit.ViewModels
|
||||||
return menu;
|
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)
|
private void FillCurrentBranchMenu(ContextMenu menu, Models.Branch current)
|
||||||
{
|
{
|
||||||
var submenu = new MenuItem();
|
var submenu = new MenuItem();
|
||||||
|
|
|
@ -1354,14 +1354,6 @@ namespace SourceGit.ViewModels
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleSelectedCommitChanged(Models.Commit commit)
|
|
||||||
{
|
|
||||||
if (SearchedCommits.Count > 0)
|
|
||||||
{
|
|
||||||
SearchResultSelectedCommit = commit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string _fullpath = string.Empty;
|
private string _fullpath = string.Empty;
|
||||||
private string _gitDir = string.Empty;
|
private string _gitDir = string.Empty;
|
||||||
private Models.GitFlow _gitflow = new Models.GitFlow();
|
private Models.GitFlow _gitflow = new Models.GitFlow();
|
||||||
|
|
|
@ -291,7 +291,6 @@ namespace SourceGit.Views
|
||||||
if (DataContext is ViewModels.Histories histories)
|
if (DataContext is ViewModels.Histories histories)
|
||||||
{
|
{
|
||||||
histories.Select(commitDataGrid.SelectedItems);
|
histories.Select(commitDataGrid.SelectedItems);
|
||||||
histories.NotifyAutoSelectedCommitChanged();
|
|
||||||
}
|
}
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue