/// <summary> /// Add new model. /// </summary> private void AddModel(GXDeviceManufacturer man) { GXDeviceModel model = new GXDeviceModel(); model.Status = DownloadStates.Add; GXDeviceModelForm dlg = new GXDeviceModelForm(model); if (dlg.ShowDialog() == DialogResult.OK) { man.Models.Add(model); //Add tree item. TreeNode parentNode = ItemToTreeNode[man] as TreeNode; TreeNode node = parentNode.Nodes.Add(model.Name); node.Tag = model; ItemToTreeNode[model] = node; //Add list item. ListViewItem li = PresetList.Items.Add(model.Name); li.Tag = model; ItemToListItem[model] = li; //Select new item from the tree. PresetTree.SelectedNode = node; } }
/// <summary> /// Edit selected model. /// </summary> private void EditModel(GXDeviceModel model) { GXDeviceModelForm dlg = new GXDeviceModelForm(model); if (dlg.ShowDialog() == DialogResult.OK) { TreeNode node = ItemToTreeNode[model] as TreeNode; node.Text = model.Name; } }