コード例 #1
0
        public override void AddItem()
        {
            RegistryQueryCollectorEditInstance editQueryInstance = new RegistryQueryCollectorEditInstance();

            if (editQueryInstance.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                ListViewItem lvi = new ListViewItem(editQueryInstance.SelectedRegistryQueryInstance.Name);
                lvi.SubItems.Add(editQueryInstance.SelectedRegistryQueryInstance.ToString());// ? editQueryInstance.SelectedRegistryQueryInstance.Server + "\\" : "") + RegistryQueryInstance.GetRegistryHiveFromString(editQueryInstance.SelectedRegistryQueryInstance.RegistryHive.ToString()).ToString() + "\\" + editQueryInstance.SelectedRegistryQueryInstance.Path);
                lvi.SubItems.Add(editQueryInstance.SelectedRegistryQueryInstance.KeyName);
                lvi.SubItems.Add(editQueryInstance.SelectedRegistryQueryInstance.SuccessValue);
                lvi.SubItems.Add(editQueryInstance.SelectedRegistryQueryInstance.WarningValue);
                lvi.SubItems.Add(editQueryInstance.SelectedRegistryQueryInstance.ErrorValue);
                lvi.Tag = editQueryInstance.SelectedRegistryQueryInstance;
                lvwEntries.Items.Add(lvi);
            }
        }
コード例 #2
0
 public override void EditItem()
 {
     if (lvwEntries.SelectedItems.Count > 0)
     {
         ListViewItem lvi = lvwEntries.SelectedItems[0];
         RegistryQueryCollectorEditInstance editQueryInstance = new RegistryQueryCollectorEditInstance();
         editQueryInstance.SelectedRegistryQueryInstance = (RegistryQueryInstance)lvi.Tag;
         if (editQueryInstance.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             lvi.Text             = editQueryInstance.SelectedRegistryQueryInstance.Name;
             lvi.SubItems[1].Text = (editQueryInstance.SelectedRegistryQueryInstance.UseRemoteServer ? editQueryInstance.SelectedRegistryQueryInstance.Server + "\\" : "") + RegistryQueryInstance.GetRegistryHiveFromString(editQueryInstance.SelectedRegistryQueryInstance.RegistryHive.ToString()).ToString() + "\\" + editQueryInstance.SelectedRegistryQueryInstance.Path;
             lvi.SubItems[2].Text = editQueryInstance.SelectedRegistryQueryInstance.KeyName;
             lvi.SubItems[3].Text = editQueryInstance.SelectedRegistryQueryInstance.SuccessValue;
             lvi.SubItems[4].Text = editQueryInstance.SelectedRegistryQueryInstance.WarningValue;
             lvi.SubItems[5].Text = editQueryInstance.SelectedRegistryQueryInstance.ErrorValue;
             lvi.Tag = editQueryInstance.SelectedRegistryQueryInstance;
             CheckOKEnabled();
         }
     }
 }