Пример #1
0
        private void storeTreeView()
        {
            TreeViewSerialization.TreeViewSerializer saveController = new TreeViewSerialization.TreeViewSerializer();
            String input = saveController.SerializeTreeView(treeView1, saveFileDialog1.FileName);

            DataRow row;
            if (dataSet1.Tables["structure"].Rows.Count > 0)
            {
                row = dataSet1.Tables["structure"].Rows[0];
                row["text"] = input;
            }
            else
            {
                row = dataSet1.Tables["structure"].NewRow();
                row["text"] = input;
                dataSet1.Tables["structure"].Rows.Add(row);
            }

            dataSet1.AcceptChanges();
        }
Пример #2
0
        private void reloadDataSet(DataSet dataSet, int dataIndex)
        {
            storeTreeView();
            DataSet oldData = this.dataSet1;

            DataSet storeData = openedSets.Find(delegate(DataSet ds) { return ds.Prefix == oldData.Prefix; });
            storeData = oldData;

            //            openedSets[openDataSetIndex] = oldData;

            this.dataSet1 = dataSet;
            openDataSetIndex = dataIndex;
            DataRow row;
            if (this.dataSet1.Tables["structure"].Rows.Count > 0)
            {
                row = this.dataSet1.Tables["structure"].Rows[0];
                treeView1.Nodes.Clear();
                TreeViewSerialization.TreeViewSerializer openController = new TreeViewSerialization.TreeViewSerializer();
                openController.DeserializeTreeView(treeView1, row["text"].ToString());
            }
            else
            {
                treeView1.Nodes.Clear();
            }
            bindingSource1.DataSource = dataSet1;
            treeView1.Sort();
        }