private void CSSTLVI(TreeListView TLV, bool expand = false) { mainTV.doSort = true; toolStripProgressBar1.Value = 0; outputtree.doSort = true; TLV.Sort(); if (expand) Controller.ExpandTLVI(TLV); else Controller.CollapseTLVI(TLV); Controller.SetImages(TLV, showicon.Checked, ref imageList1); TLV.Show(); menuStrip1.Enabled = true; TC.Enabled = true; }
//tree to file public static void SerializeTreeListView(TreeListView TreeListView, string fileName) { try { XmlTextWriter textWriter = new XmlTextWriter(fileName, System.Text.Encoding.ASCII); // writing the xml declaration tag textWriter.WriteStartDocument(); //textWriter.WriteRaw("\r\n"); // writing the main tag that encloses all node tags textWriter.WriteStartElement("TreeListView"); // save the nodes, recursive method TreeListView.Sort(); SaveNodes(TreeListView.Items, textWriter); textWriter.WriteEndElement(); textWriter.Close(); } catch (Exception ex) { MessageBox.Show("Error writing file:" + ex.ToString()); return; } }