mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
fix<RevisionFiles>: fix revision file tree missing issue due to Unloaded event will be called on active tab changed
This commit is contained in:
parent
8db90574bb
commit
dcf24db75a
3 changed files with 19 additions and 2 deletions
|
@ -13,7 +13,7 @@ namespace SourceGit.Views.Widgets {
|
|||
/// </summary>
|
||||
public partial class CommitChanges : UserControl {
|
||||
private string repo = null;
|
||||
private List<Models.Commit> range = null;
|
||||
private List<Models.Commit> range = new List<Models.Commit>();
|
||||
private List<Models.Change> cachedChanges = new List<Models.Change>();
|
||||
private string filter = null;
|
||||
private bool isSelecting = false;
|
||||
|
@ -31,6 +31,14 @@ namespace SourceGit.Views.Widgets {
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void CleanUp() {
|
||||
range.Clear();
|
||||
cachedChanges.Clear();
|
||||
modeTree.ItemsSource = new List<ChangeNode>();
|
||||
modeGrid.ItemsSource = new List<Models.Change>();
|
||||
modeList.ItemsSource = new List<Models.Change>();
|
||||
}
|
||||
|
||||
public void SetData(string repo, List<Models.Commit> range, List<Models.Change> changes) {
|
||||
this.repo = repo;
|
||||
this.range = range;
|
||||
|
|
|
@ -19,6 +19,12 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
public CommitDetail() {
|
||||
InitializeComponent();
|
||||
|
||||
Unloaded += (o, e) => {
|
||||
changeList.ItemsSource = new List<Models.Change>();
|
||||
changeContainer.CleanUp();
|
||||
revisionFiles.Cleanup();
|
||||
};
|
||||
}
|
||||
|
||||
public void SetData(string repo, Models.Commit commit) {
|
||||
|
|
|
@ -32,7 +32,6 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
public RevisionFiles() {
|
||||
InitializeComponent();
|
||||
Unloaded += (o, e) => treeFiles.ItemsSource = new List<FileNode>();
|
||||
}
|
||||
|
||||
public void SetData(string repo, string sha, Commands.Context cancelToken) {
|
||||
|
@ -109,6 +108,10 @@ namespace SourceGit.Views.Widgets {
|
|||
});
|
||||
}
|
||||
|
||||
public void Cleanup() {
|
||||
treeFiles.ItemsSource = new List<FileNode>();
|
||||
}
|
||||
|
||||
private void SortFileNodes(List<FileNode> nodes) {
|
||||
nodes.Sort((l, r) => {
|
||||
if (l.IsFolder == r.IsFolder) {
|
||||
|
|
Loading…
Reference in a new issue