private void BTN_Add_Click(object sender, EventArgs e) { var data = DGV_NewNodeInfo.DataSource as DataTable; ConfItem newnode; if (data.Columns.Count > 2)//ConfTree { newnode = _tree.Sons[0].Clone(); var newtree = newnode as ConfTree; newtree.Clear(); newtree.Name = data.Rows[0][0] as string; for (int i = 1; i < data.Rows.Count; i++) { if (!string.IsNullOrEmpty(data.Rows[i][1] as string)) { newtree[data.Rows[i][1] as string] = data.Rows[i][2] as string; } } } else { return; } _tree.AddNode(newnode); _root.Save(); _onChange.Invoke(); }