コード例 #1
0
 public GXDeviceModelForm(GXDeviceModel model)
 {
     InitializeComponent();
     Model = model;
     NameTB.Text = model.Name;
     DescriptionTB.Text = model.Description;
 }
コード例 #2
0
 /// <summary>
 /// Copy Constructor.
 /// </summary>
 public GXDeviceModel(GXDeviceModel item)
 {
     Versions = new GXDeviceVersionCollection(this);
     Name = item.Name;
     Description = item.Description;
     foreach (GXDeviceVersion it in item.Versions)
     {
         Versions.Add(new GXDeviceVersion(it));
     }
 }               
コード例 #3
0
 public void Next()
 {
     if (ModelCB.SelectedIndex == -1)
     {
         ModelCB.Focus();
         throw new Exception(Gurux.DeviceSuite.Properties.Resources.ErrNameEmptyTxt);
     }
     if ((ModelCB.SelectedItem as GXDeviceModel).Versions.Count == 0)
     {
         throw new Exception(Gurux.DeviceSuite.Properties.Resources.PublishFailedNotEnoughtData);                
     }
     //Update selected model to target.
     Target = SelectedModel = ModelCB.SelectedItem as GXDeviceModel;
     Item.Manufacturers[0].Models.Clear();
     Item.Manufacturers[0].Models.Add(SelectedModel);
 }
コード例 #4
0
 /// <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);
     }
 }
コード例 #5
0
 /// <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;
     }
 }
コード例 #6
0
 /// <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;
     }
 }
コード例 #7
0
 public void Initialize()
 {
     GXDeviceModel model = Target as GXDeviceModel;
     if (model != null)
     {
         SelectedModel = model;
         VersionCB.Items.Clear();
         foreach (GXDeviceVersion it in model.Versions)
         {
             VersionCB.Items.Add(it);
         }
         if (VersionCB.Items.Count != 0)
         {
             VersionCB.SelectedIndex = 0;
         }
     }                 
 }