private void FillFileList() { string scriptFolder = Settings.ScriptFolder; tlvScripts.BeginUpdate(); AddFoldersAndFiles(tlvScripts.Nodes, scriptFolder); tlvScripts.EndUpdate(); }
public void SaveState() { SaveTopItem(); SaveSelection(); TreeListView.BeginUpdate(); }
/// <summary> /// Adds an array of <see cref="TreeListViewColumnHeader"/> objects to the collection. /// </summary> /// <param name="columns">An array of <see cref="TreeListViewColumnHeader"/> objects to add to the collection.</param> public void AddRange(TreeListViewColumnHeader[] columns) { if (columns == null) { return; } _listView.BeginUpdate(); lock (_physicalData.SyncRoot) for (int index = 0; index < columns.Length; ++index) { Add(columns[index]); } _listView.EndUpdate(); }
/// <summary> /// Removes the specified <see cref="TreeListViewItem"/> from the collection. /// </summary> /// <param name="item">A <see cref="TreeListViewItem"/> to remove from the collection.</param> /// <custom type="modified">Fixed bugs (the method was throwing exceptions) and improved the method.</custom> public void Remove(TreeListViewItem item) { // Aulofee customization - start. Bug fixed + improvments (initial method is at the end) if (item == null) { return; } // Aulofee customization - start. Line below added. _listView.BeginUpdate(); TreeListViewItem recalculateFrom = RemoveInternal(item); _listView.RecalculateItemPositions(recalculateFrom); // Aulofee customization - start. Line below added. _listView.EndUpdate(); }
public void AddRange(TreeListViewItemCollection collection) { if (TreeListView != null) { TreeListView.BeginUpdate(); } AddRangeInternal(collection); if (TreeListView != null) { TreeListView.BeginUpdate(); } }
public void Sort(bool recursively) { if (TreeListView != null) { TreeListView.BeginUpdate(); } SortInternal(recursively); if (TreeListView != null) { TreeListView.EndUpdate(); } }
public new void RemoveAt(int index) { TreeListView treelistview = this.TreeListView; if (treelistview != null) { treelistview.BeginUpdate(); } RemoveAtInternal(index); if (treelistview != null) { treelistview.EndUpdate(); } }
public virtual void Remove(TreeListViewItem item) { TreeListView treelistview = this.TreeListView; if (treelistview != null) { treelistview.BeginUpdate(); } RemoveInternal(item); if (treelistview != null) { treelistview.EndUpdate(); } }
public new void Clear() { TreeListView treelistview = this.TreeListView; if (treelistview != null) { treelistview.BeginUpdate(); } ClearInternal(); if (treelistview != null) { treelistview.EndUpdate(); } }
/// <summary> /// Collapse /// </summary> public void Collapse() { if (IsInATreeListView) { if (ListView.InvokeRequired) { throw (new Exception("Invoke Required")); } } if (TreeListView != null) { TreeListView.BeginUpdate(); } CollapseInternal(); if (TreeListView != null) { TreeListView.EndUpdate(); } }
// 2011-07-08 添加 ------------------------------------------------------------------------- /// <summary> /// 从根结点展开到此结点可见 /// </summary> public void ExpandParents() { if (IsInATreeListView) { if (ListView.InvokeRequired) { throw (new Exception("Invoke Required")); } } if (TreeListView != null) { TreeListView.BeginUpdate(); } ExpandParentsInternal(); if (TreeListView != null) { TreeListView.EndUpdate(); } }
/// <summary> /// Adds an array of <see cref="TreeListViewItem"/> objects to the selected item collection. /// </summary> /// <param name="items">An array of <see cref="TreeListViewItem"/> objects to add to the collection.</param> public void AddRange(TreeListViewItem[] items) { if (items == null) { return; } _listView.BeginUpdate(); lock (_data.SyncRoot) { for (int index = 0; index < items.Length; ++index) { _data.Add(items[index]); } } _listView.EndUpdate(); }
private void GetData(TreeListView olv) { try { pbrProgress.Visible = true; olv.BeginUpdate(); olv.Items.Clear(); olv.CanExpandGetter = delegate(object SB) { return(((StaffBranch)SB).Children.Count > 0); }; olv.ChildrenGetter = delegate(object SB) { return(((StaffBranch)SB).Children); }; olv.Roots = GetAnalysisTree(); olv.Expand(olv.TreeModel.GetNthObject(0)); olv.EndUpdate(); lblRecord.Text = "0 z " + olv.Items.Count; olv.Enabled = olv.Items.Count > 0 ? true : false; pbrProgress.Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Ensure that the node is visible (expand parents and scroll listview so that the item is visible) /// </summary> new public void EnsureVisible() { if (!Visible) { if (IsInATreeListView) { TreeListView.BeginUpdate(); } if (ListView != null) { ListView.Invoke(new MethodInvoker(ExpandParents)); } else { ExpandParents(); } if (TreeListView != null) { TreeListView.EndUpdate(); } } base.EnsureVisible(); }
//from file to tree public static void DeserializeTreeListView(Form1.IncrementStatusDel incrementStatus, TreeListView TreeListView, string fileName) { XmlTextReader reader = null; try { // disabling re-drawing of TreeListView till all nodes are added TreeListView.BeginUpdate(); reader = new XmlTextReader(fileName); TreeListViewItem parentNode = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.Name == XmlNodeTag) { TreeListViewItem newNode = new TreeListViewItem(); 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); } } newNode.SubItems.Add(newNode.nodeSize.getSizeString()); newNode.SubItems.Add(newNode.fullPath); newNode.Name = newNode.fullPath; incrementStatus(true); // add new node to Parent Node or TreeListView if (parentNode != null) { parentNode.Items.Add(newNode); } else { TreeListView.Items.Add(newNode); } // making current node 'ParentNode' if its not empty if (!isEmptyElement) { parentNode = newNode; } } } // moving up to in TreeListView if end tag is encountered else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == XmlNodeTag) { parentNode = parentNode.Parent; } } } } finally { // enabling redrawing of TreeListView after all nodes are added TreeListView.EndUpdate(); reader.Close(); } }
public void BeginUpdate() { _internalList.BeginUpdate(); }
void _activator_Emphasise(object sender, EmphasiseEventArgs args) { var rootObject = _activator.GetRootObjectOrSelf(args.Request.ObjectToEmphasise); // unpin first if there is somthing pinned, so we find our object! if (_pinFilter != null && _activator.IsRootObjectOfCollection(_collection, rootObject)) { _pinFilter.UnApplyToTree(); } //get the parental hierarchy var decendancyList = CoreChildProvider.GetDescendancyListIfAnyFor(args.Request.ObjectToEmphasise); if (decendancyList != null) { //for each parent in the decendandy list foreach (var parent in decendancyList.Parents) { //parent isn't in our tree if (Tree.IndexOf(parent) == -1) { return; } //parent is in our tree so make sure it's expanded Tree.Expand(parent); } } //tree doesn't contain object even after expanding parents int index = Tree.IndexOf(args.Request.ObjectToEmphasise); if (index == -1) { return; } if (args.Request.ExpansionDepth > 0) { try { Tree.BeginUpdate(); ExpandToDepth(args.Request.ExpansionDepth, args.Request.ObjectToEmphasise); } finally { Tree.EndUpdate(); } } if (args.Request.Pin && Settings.AllowPinning) { Pin(args.Request.ObjectToEmphasise, decendancyList); } //update index now pin filter is applied index = Tree.IndexOf(args.Request.ObjectToEmphasise); //select the object and ensure it's visible Tree.SelectedObject = args.Request.ObjectToEmphasise; Tree.EnsureVisible(index); args.Sender = Tree.FindForm(); }
private void BtnClick(object sender, EventArgs e) { var btn = (Button)sender; var flags = (Buttons)btn.Tag; switch (flags) { case Buttons.AddFlat: DataContainer.GenerateFlat( View, (TreeListView.TheStyle != TreeListView.Style.TreeList) && (TreeListView.TheStyle != TreeListView.Style.CheckedTreeList) ? null : TreeListViewAdapter.LastHit); break; case Buttons.AddHierarchical: DataContainer.GenerateHierarchical( View, TreeListViewAdapter.LastHit); break; case Buttons.AddVirtual: DataContainer.GenerateVirtual(View); break; case Buttons.Reload: DataContainer.Reload(View); break; case Buttons.ExpandAll: TreeListView.ExpandAll(); break; case Buttons.CollapseAll: TreeListView.CollapseAll(); break; case Buttons.RemoveItem: DataContainer.RemoveItem(View, TreeListViewAdapter.LastHit); break; case Buttons.ModifySelected: DataContainer.ModifySelected(View, TreeListViewAdapter.Selection); break; case Buttons.SelectAll: { TreeListView.BeginUpdate(); foreach (var node in TreeListView.Nodes) { node.Selected = true; } TreeListView.EndUpdate(); } break; case Buttons.RecursiveCheckBoxes: { TreeListView.RecursiveCheckBoxes = !TreeListView.RecursiveCheckBoxes; btn.Text = TreeListView.RecursiveCheckBoxes ? RecursiveCheckBoxesOnText : RecursiveCheckBoxesOffText; } break; } }