Пример #1
0
 private void editToolStripButton_Click(object sender, EventArgs e)
 {
     if (lvwQueries.SelectedItems.Count > 0 && lvwQueries.SelectedItems[0].Tag is WMIConfigEntry)
     {
         EditConfigEntry editConfigEntry = new EditConfigEntry();
         editConfigEntry.WmiIConfigEntry = (WMIConfigEntry)lvwQueries.SelectedItems[0].Tag;
         if (editConfigEntry.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             ListViewItem lvi = lvwQueries.SelectedItems[0];
             lvi.Text             = editConfigEntry.WmiIConfigEntry.Name;
             lvi.SubItems[1].Text = editConfigEntry.WmiIConfigEntry.Machinename;
             lvi.SubItems[2].Text = editConfigEntry.WmiIConfigEntry.Namespace;
             lvi.SubItems[3].Text = editConfigEntry.WmiIConfigEntry.DetailQuery;
             lvi.Tag = editConfigEntry.WmiIConfigEntry;
         }
     }
 }
Пример #2
0
        private void addToolStripButton_Click(object sender, EventArgs e)
        {
            EditConfigEntry editConfigEntry = new EditConfigEntry();

            editConfigEntry.WmiIConfigEntry = new WMIConfigEntry();
            if (editConfigEntry.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ListViewItem lvi = new ListViewItem(editConfigEntry.WmiIConfigEntry.Name);
                lvi.SubItems.Add(editConfigEntry.WmiIConfigEntry.Machinename);
                lvi.SubItems.Add(editConfigEntry.WmiIConfigEntry.Namespace);
                lvi.SubItems.Add(editConfigEntry.WmiIConfigEntry.DetailQuery);
                lvi.Tag = editConfigEntry.WmiIConfigEntry;
                lvwQueries.Items.Add(lvi);
                CheckOKEnabled();
                CheckButtonsEnable();
            }
        }