sourcegit/src/Views/Widgets/RevisionCompare.xaml.cs

39 lines
1.4 KiB
C#
Raw Normal View History

2021-04-29 05:05:55 -07:00
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;
2021-04-29 05:05:55 -07:00
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;
2021-04-29 05:05:55 -07:00
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);
});
});
}
}
}