mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-03 12:33:21 -08:00
37 lines
1.3 KiB
C#
37 lines
1.3 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;
|
||
|
txtStartSHA.Text = start.ShortSHA;
|
||
|
txtStartTime.Text = start.Committer.Time;
|
||
|
txtStartSubject.Text = start.Subject;
|
||
|
|
||
|
avatarEnd.Email = end.Committer.Email;
|
||
|
avatarEnd.FallbackLabel = 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);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|