/// <summary> /// Refresh the tree view of branches /// </summary> public void BranchesRefresh() { // Use predefined [0] for local and [1] for remote branches treeBranches.Nodes[0].Nodes.Clear(); treeBranches.Nodes[1].Nodes.Clear(); if (App.Repos.Current != null) { ClassBranches branches = App.Repos.Current.Branches; branches.Refresh(); // Add all local branches to the tree foreach (string s in branches.Local) { TreeNode tn = new TreeNode(s, (int)BranchIcons.BranchIdle, (int)BranchIcons.BranchIdle); tn.Tag = s; if (s == branches.Current) { tn.SelectedImageIndex = tn.ImageIndex = (int)BranchIcons.BranchSelected; } treeBranches.Nodes[0].Nodes.Add(tn); } // Add all remote branches to the tree foreach (string s in branches.Remote) { TreeNode tn = new TreeNode(s, (int)BranchIcons.BranchIdle, (int)BranchIcons.BranchIdle); tn.Tag = s; treeBranches.Nodes[1].Nodes.Add(tn); } } // By default, expand branches treeBranches.ExpandAll(); }