mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Controls;
|
|
|
|
namespace SourceGit.Views.Widgets {
|
|
/// <summary>
|
|
/// 展示两个提交之间的变更
|
|
/// </summary>
|
|
public partial class RevisionCompare : UserControl {
|
|
|
|
public RevisionCompare() {
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetData(string repo, Models.Commit start, Models.Commit end) {
|
|
avatarStart.Email = start.Committer.Email;
|
|
avatarStart.FallbackLabel = start.Committer.Name;
|
|
avatarStart.ToolTip = start.Committer.Name;
|
|
txtStartSHA.Text = start.ShortSHA;
|
|
txtStartTime.Text = start.Committer.Time;
|
|
txtStartSubject.Text = start.Subject;
|
|
|
|
avatarEnd.Email = end.Committer.Email;
|
|
avatarEnd.FallbackLabel = end.Committer.Name;
|
|
avatarEnd.ToolTip = end.Committer.Name;
|
|
txtEndSHA.Text = end.ShortSHA;
|
|
txtEndTime.Text = end.Committer.Time;
|
|
txtEndSubject.Text = end.Subject;
|
|
|
|
Task.Run(() => {
|
|
var changes = new Commands.CommitRangeChanges(repo, start.SHA, end.SHA).Result();
|
|
Dispatcher.Invoke(() => {
|
|
changesContainer.SetData(repo, new List<Models.Commit>() { start, end }, changes);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|