/// <summary>
 /// Add new version and select it.
 /// </summary>
 private void AddVersion(GXDeviceModel model)
 {
     try
     {
         GXDeviceVersion version = new GXDeviceVersion();
         version.Status = DownloadStates.Add;
         GXDeviceVersionForm dlg = new GXDeviceVersionForm(version);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             model.Versions.Add(version);
             //Add tree item.
             TreeNode parentNode = ItemToTreeNode[model] as TreeNode;
             TreeNode node = parentNode.Nodes.Add(version.Name);
             node.Tag = version;
             ItemToTreeNode[version] = node;
             //Add list item.
             ListViewItem li = PresetList.Items.Add(version.Name);
             li.Tag = version;
             ItemToListItem[version] = li;
             //Select new item from the tree.
             PresetTree.SelectedNode = node;
         }
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.Parent, ex);
     }
 }
 /// <summary>
 /// Edit selected version.
 /// </summary>
 private void EditVersion(GXDeviceVersion version)
 {
     try
     {
         GXDeviceVersionForm dlg = new GXDeviceVersionForm(version);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             TreeNode node = ItemToTreeNode[version] as TreeNode;
             node.Text = version.Name;
         }
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.Parent, ex);
     }
 }