Skip to content

Commit 9ca70ff

Browse files
committed
feat: 添加对悬停项的详细信息输出,更新视图模型和UI
1 parent a873b04 commit 9ca70ff

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/ViewModels/Histories.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ public void Select(IList commits, object selectedCommit)
224224
_repo.SelectedCommits = commits.Cast<Models.Commit>().ToList();
225225
}
226226

227+
public void ProcessHoveredCommit(Models.Commit commit)
228+
{
229+
if (commit == null)
230+
return;
231+
232+
var childrens = this.GetChildrensPathInCurHistory(commit, out _, 0);
233+
Console.WriteLine($"=========");
234+
childrens.Reverse();
235+
236+
foreach (var c in childrens)
237+
{
238+
Console.WriteLine($"{c.Index}.{c.Subject}");
239+
}
240+
System.Console.WriteLine(childrens.Count);
241+
}
242+
227243
public void MarkLastSelectedCommitsAsSelected(params IList<Models.Commit> commits)
228244
{
229245
var availableCommits = Commits.Where(x => commits.Any(y => y.SHA == x.SHA)).ToList();

src/Views/Histories.axaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ private void OnDataGridPointerMoved(object sender, PointerEventArgs e)
253253
if (!Equals(_hoveredItem, item))
254254
{
255255
_hoveredItem = item;
256+
// 在这里可以更新VM、UI等
257+
var hs = dataGrid.DataContext as ViewModels.Histories;
258+
hs?.ProcessHoveredCommit(item as Models.Commit);
256259
}
257260
}
258261
}

0 commit comments

Comments
 (0)