/// <summary> /// Edit an existing item /// </summary> private void cmEditItem_Click(object sender, EventArgs e) { if (SelectedItem != null) { var form = new QuickItem(); form.Item = SelectedItem; if (form.ShowDialog() == DialogResult.OK) { var catNode = tCat.SelectedNode; tCat.SelectedNode = null; tCat.SelectedNode = catNode; foreach (TreeNode t in tItems.Nodes) { if (t.Tag as BoxItem == form.Item) { tItems.SelectedNode = t; break; } } UpdateData(); } } }
/// <summary> /// Create a new item entry /// </summary> private void cmAddItem_Click(object sender, EventArgs e) { var form = new QuickItem(); if (form.ShowDialog() == DialogResult.OK) { // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert (tCat.SelectedNode.Tag as List <object>).Add(form.Item); // Issue 10 - End var catNode = tCat.SelectedNode; tCat.SelectedNode = null; tCat.SelectedNode = catNode; foreach (TreeNode t in tItems.Nodes) { if (t.Tag as BoxItem == form.Item) { tItems.SelectedNode = t; break; } } UpdateData(); } }