Skip to content

Commit 764cf24

Browse files
committed
code_review: PR #120
* remove unnecessary code. The `SetProperty` function takes care of set same property in a loop
1 parent efd8e72 commit 764cf24

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

src/ViewModels/Histories.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,14 @@ public void Select(IList commits)
134134
{
135135
if (commits.Count == 0)
136136
{
137+
_repo.SearchResultSelectedCommit = null;
137138
DetailContext = null;
138139
}
139140
else if (commits.Count == 1)
140141
{
141142
var commit = commits[0] as Models.Commit;
143+
_repo.SearchResultSelectedCommit = commit;
144+
142145
AutoSelectedCommit = commit;
143146
NavigationId = _navigationId + 1;
144147

@@ -155,12 +158,15 @@ public void Select(IList commits)
155158
}
156159
else if (commits.Count == 2)
157160
{
161+
_repo.SearchResultSelectedCommit = null;
162+
158163
var end = commits[0] as Models.Commit;
159164
var start = commits[1] as Models.Commit;
160165
DetailContext = new RevisionCompare(_repo.FullPath, start, end);
161166
}
162167
else
163168
{
169+
_repo.SearchResultSelectedCommit = null;
164170
DetailContext = new CountSelectedCommits() { Count = commits.Count };
165171
}
166172
}
@@ -369,18 +375,6 @@ public ContextMenu MakeContextMenu()
369375
return menu;
370376
}
371377

372-
public void NotifyAutoSelectedCommitChanged()
373-
{
374-
if (DetailContext is CommitDetail detail)
375-
{
376-
_repo.HandleSelectedCommitChanged(detail.Commit);
377-
}
378-
else
379-
{
380-
_repo.HandleSelectedCommitChanged(null);
381-
}
382-
}
383-
384378
private void FillCurrentBranchMenu(ContextMenu menu, Models.Branch current)
385379
{
386380
var submenu = new MenuItem();

src/ViewModels/Repository.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,14 +1354,6 @@ public ContextMenu CreateContextMenuForSubmodule(string submodule)
13541354
return menu;
13551355
}
13561356

1357-
public void HandleSelectedCommitChanged(Models.Commit commit)
1358-
{
1359-
if (SearchedCommits.Count > 0)
1360-
{
1361-
SearchResultSelectedCommit = commit;
1362-
}
1363-
}
1364-
13651357
private string _fullpath = string.Empty;
13661358
private string _gitDir = string.Empty;
13671359
private Models.GitFlow _gitflow = new Models.GitFlow();

src/Views/Histories.axaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ private void OnCommitDataGridSelectionChanged(object sender, SelectionChangedEve
291291
if (DataContext is ViewModels.Histories histories)
292292
{
293293
histories.Select(commitDataGrid.SelectedItems);
294-
histories.NotifyAutoSelectedCommitChanged();
295294
}
296295
e.Handled = true;
297296
}

0 commit comments

Comments
 (0)