static void OnReloadBranches(ICollection <BaseBranchNode> items, RootNode <BaseBranchNode> rootNode) { // todo: cache: per Repo, on BranchNode.FullPath BranchesNode branchesNode = (BranchesNode)rootNode; rootNode.TreeNode.Text = string.Format("{0} ({1})", Strings.branches, branchesNode.Branches.Count()); }
public BranchNode(GitUICommands uiCommands, string branch, int level, string activeBranchPath = null, BranchPathNode parent = null, bool isLocal = true) : base(uiCommands, BranchesNode.GetName(branch), level, parent, isLocal) { IsActive = Equals(activeBranchPath, FullPath); IsDraggable = true; AllowDrop = true; }
protected override void OnUICommandsSourceChanged(object sender, IGitUICommandsSource newSource) { base.OnUICommandsSourceChanged(sender, newSource); DragDrops(); AddRootNode(new BranchesNode( new TreeNode(Strings.branches.Text) { ContextMenuStrip = menuBranches, ImageKey = branchesKey }, UICommands, () => { var branchNames = Module.GetBranchNames().ToArray(); return(BranchesNode.GetBranchTree(UICommands, branchNames)); }, OnAddBranchNode )); AddTreeSet(new TreeNode(Strings.stashes.Text) { ContextMenuStrip = menuStashes, ImageKey = stashesKey }, () => Module.GetStashes().Select(stash => new StashNode(stash, UICommands)).ToList(), OnReloadStashes, OnAddStash ); //AddTreeSet(nodeTags, ...); if (isFirst) {// bypass reloading twice // (once from initial UICommandsSource being set) // (once from FormBrowse Initialize()) isFirst = false; } else { RepoChanged(); } }