feature<PageTabBar>: add context menu to close tabs and modify bookmarks

This commit is contained in:
Jai 2021-08-19 08:58:41 +08:00
parent 232c209079
commit 602f934fae
6 changed files with 107 additions and 1 deletions

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -368,6 +369,21 @@ namespace SourceGit.Views.Widgets {
var repo = Models.Preference.Instance.AddRepository(root, gitDir, "");
Models.Watcher.Open(repo);
}
public void UpdateNodes(string id, int bookmark, IEnumerable<Node> nodes = null) {
if (nodes == null) nodes = tree.ItemsSource.OfType<Node>();
foreach (var node in nodes) {
if (!node.IsGroup) {
if (node.Id == id) {
node.Bookmark = bookmark;
break;
}
} else if (node.Children.Count > 0) {
UpdateNodes(id, bookmark, node.Children);
}
}
}
#endregion
#region RENAME_NODES