コード例 #1
0
 /// <summary>
 /// Add new device template and select it.
 /// </summary>
 private void AddTemplate(GXDeviceVersion version)
 {
     try
     {
         GXPublishedDeviceProfile type = new GXPublishedDeviceProfile();
         type.Status = DownloadStates.Add;
         GXDeviceProfilesForm dlg = new GXDeviceProfilesForm(type);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             type = dlg.Target;
             type.Status = DownloadStates.Add;
             version.Templates.Add(type);
             //Add list item.
             ListViewItem li = PresetList.Items.Add(type.PresetName);
             li.Tag = type;
             ItemToListItem[type] = li;
         }
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.Parent, ex);
     }
 }
コード例 #2
0
 /// <summary>
 /// Edit selected device template.
 /// </summary>
 private void EditTemplate(GXPublishedDeviceProfile type)
 {
     try
     {
         GXDeviceProfilesForm dlg = new GXDeviceProfilesForm(type);
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             TreeNode node = ItemToTreeNode[type] as TreeNode;
             if (node != null)
             {
                 node.Text = type.PresetName;
             }
         }
     }
     catch (Exception ex)
     {
         GXCommon.ShowError(this.Parent, ex);
     }
 }