Ejemplo n.º 1
0
        public override void AddItem()
        {
            WMIQueryCollectorEditEntry editConfigEntry = new WMIQueryCollectorEditEntry();

            editConfigEntry.SelectedWMIQueryEntry = new WMIQueryEntry();
            if (editConfigEntry.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ListViewItem lvi = new ListViewItem(editConfigEntry.SelectedWMIQueryEntry.Name);
                lvi.SubItems.Add(editConfigEntry.SelectedWMIQueryEntry.Machinename);
                lvi.SubItems.Add(editConfigEntry.SelectedWMIQueryEntry.Namespace);
                lvi.SubItems.Add(editConfigEntry.SelectedWMIQueryEntry.DetailQuery);
                lvi.Tag = editConfigEntry.SelectedWMIQueryEntry;
                lvwEntries.Items.Add(lvi);
            }
        }
Ejemplo n.º 2
0
 public override void EditItem()
 {
     if (lvwEntries.SelectedItems.Count > 0 && lvwEntries.SelectedItems[0].Tag is WMIQueryEntry)
     {
         WMIQueryCollectorEditEntry editConfigEntry = new WMIQueryCollectorEditEntry();
         editConfigEntry.SelectedWMIQueryEntry = (WMIQueryEntry)lvwEntries.SelectedItems[0].Tag;
         if (editConfigEntry.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             ListViewItem lvi = lvwEntries.SelectedItems[0];
             lvi.Text             = editConfigEntry.SelectedWMIQueryEntry.Name;
             lvi.SubItems[1].Text = editConfigEntry.SelectedWMIQueryEntry.Machinename;
             lvi.SubItems[2].Text = editConfigEntry.SelectedWMIQueryEntry.Namespace;
             lvi.SubItems[3].Text = editConfigEntry.SelectedWMIQueryEntry.DetailQuery;
             lvi.Tag = editConfigEntry.SelectedWMIQueryEntry;
         }
     }
 }