protected override void ClearItems() { _tree.BeginUpdate(); try { while (this.Count != 0) { this.RemoveAt(this.Count - 1); } } finally { _tree.EndUpdate(); } }
void watchList_DragDrop(object sender, DragEventArgs e) { watchList.BeginUpdate(); TextNode text = new TextNode(e.Data.GetData(DataFormats.StringFormat).ToString()); TreeViewVarNode node = new TreeViewVarNode(this.debuggedProcess, this.watchList, text); watches.Add(text); watchList.Root.Children.Add(node); watchList.EndUpdate(); node.IsSelected = true; this.RefreshPad(); }
public override void RefreshPad() { if (debuggedProcess == null || debuggedProcess.IsRunning || debuggedProcess.SelectedStackFrame == null) { localVarList.Root.Children.Clear(); return; } using (new PrintTimes("Local Variables refresh")) { try { localVarList.BeginUpdate(); Utils.DoEvents(debuggedProcess); TreeViewVarNode.SetContentRecursive(debuggedProcess, localVarList, new StackFrameNode(debuggedProcess.SelectedStackFrame).ChildNodes); } catch (AbortedBecauseDebuggeeResumedException) { } catch (Exception) { if (debuggedProcess == null || debuggedProcess.HasExited) { // Process unexpectedly exited } else { throw; } } finally { localVarList.EndUpdate(); } } }
private void treeViewAdvControl_DragDrop(object sender, DragEventArgs e) { TreeViewAdv _tree = treeViewAdvControl; _tree.BeginUpdate(); TreeNodeAdv[] nodes = (TreeNodeAdv[])e.Data.GetData(typeof(TreeNodeAdv[])); Node dropNode = _tree.DropPosition.Node.Tag as Node; if (_tree.DropPosition.Position == NodePosition.Inside) { Constant.NodeTypeDefine nodetype = (dropNode.Tag as PlistNodeData).nodeType; if (nodetype == Constant.NodeTypeDefine.array || nodetype == Constant.NodeTypeDefine.dict) { foreach (TreeNodeAdv n in nodes) { (n.Tag as Node).Parent = dropNode; } _tree.DropPosition.Node.IsExpanded = true; } } else { Node parent = dropNode.Parent; Node nextItem = dropNode; if (_tree.DropPosition.Position == NodePosition.After) { nextItem = dropNode.NextNode; } foreach (TreeNodeAdv node in nodes) { (node.Tag as Node).Parent = null; } int index = -1; index = parent.Nodes.IndexOf(nextItem); foreach (TreeNodeAdv node in nodes) { Node item = node.Tag as Node; if (index == -1) { parent.Nodes.Add(item); } else { parent.Nodes.Insert(index, item); index++; } } } _tree.EndUpdate(); }
public static void ExpandNodes(this TreeViewAdv treeView, HashSet <ITabularObjectContainer> nodeObjects) { treeView.BeginUpdate(); treeView.AllNodes .Where(n => nodeObjects.Contains(n.Tag)) .ToList().ForEach(n => n.Expand()); // Expand folders by paths (necessary when the folder structure has changed): treeView.AllNodes.Where(n => n.Tag is Folder && nodeObjects.Any(o => o is Folder && (o as Folder).FullPath == (n.Tag as Folder).FullPath)).ToList().ForEach(n => n.Expand()); treeView.EndUpdate(); }
public static void DoPartsCategory(string Category, TreeViewAdv Tree) { XmlFile PartList = XmlFile.XmlFileFromCache(db.DataPath + Category + ".txt"); TreeModel model = Tree.Model as TreeModel; Tree.BeginUpdate(); Tree.Model = model; ColoredTextNode parent = new ColoredTextNode(Category); parent.Tag = Category; model.Nodes.Add(parent); foreach (string section in PartList.stListSectionNames()) { ColoredTextNode child = new ColoredTextNode(); child.Text = section; child.Tag = section; parent.Nodes.Add(child); } Tree.EndUpdate(); }
public void DeserializeTreeView(TreeViewAdv treeView, string fileName) { XmlTextReader reader = null; try { // disabling re-drawing of treeview till all nodes are added treeView.BeginUpdate(); reader = new XmlTextReader(fileName); TreeNodeAdv parentNode = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.Name == XmlNodeTag) { var newNode = new TreeNodeAdv(); bool isEmptyElement = reader.IsEmptyElement; // loading node attributes int attributeCount = reader.AttributeCount; if (attributeCount > 0) { for (int i = 0; i < attributeCount; i++) { reader.MoveToAttribute(i); SetAttributeValue(newNode, reader.Name, reader.Value); } } // add new node to Parent Node or TreeView if (parentNode != null) parentNode.Nodes.Add(newNode); else treeView.Nodes.Add(newNode); // making current node 'ParentNode' if its not empty if (!isEmptyElement) { parentNode = newNode; } } } // moving up to in TreeView if end tag is encountered else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == XmlNodeTag) { if (parentNode != null) parentNode = parentNode.Parent; } } else if (reader.NodeType == XmlNodeType.XmlDeclaration) { //Ignore Xml Declaration } else if (reader.NodeType == XmlNodeType.None) { return; } else if (reader.NodeType == XmlNodeType.Text) { if (parentNode != null) parentNode.Nodes.Add(reader.Value); } } } finally { // enabling redrawing of treeview after all nodes are added treeView.EndUpdate(); if (reader != null) reader.Close(); } }
public void DeserializeTreeView(TreeViewAdv treeView, string fileName) { XmlTextReader reader = null; try { // disabling re-drawing of treeview till all nodes are added treeView.BeginUpdate(); reader = new XmlTextReader(fileName); TreeNodeAdv parentNode = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.Name == XmlNodeTag) { var newNode = new TreeNodeAdv(); bool isEmptyElement = reader.IsEmptyElement; // loading node attributes int attributeCount = reader.AttributeCount; if (attributeCount > 0) { for (int i = 0; i < attributeCount; i++) { reader.MoveToAttribute(i); SetAttributeValue(newNode, reader.Name, reader.Value); } } // add new node to Parent Node or TreeView if (parentNode != null) { parentNode.Nodes.Add(newNode); } else { treeView.Nodes.Add(newNode); } // making current node 'ParentNode' if its not empty if (!isEmptyElement) { parentNode = newNode; } } } // moving up to in TreeView if end tag is encountered else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == XmlNodeTag) { if (parentNode != null) { parentNode = parentNode.Parent; } } } else if (reader.NodeType == XmlNodeType.XmlDeclaration) { //Ignore Xml Declaration } else if (reader.NodeType == XmlNodeType.None) { return; } else if (reader.NodeType == XmlNodeType.Text) { if (parentNode != null) { parentNode.Nodes.Add(reader.Value); } } } } finally { // enabling redrawing of treeview after all nodes are added treeView.EndUpdate(); if (reader != null) { reader.Close(); } } }
protected override void AfterPerform() { _aTreeView.EndUpdate(); }