public void ShouldInstallAndUninstallFirstCategory()
        {
            PerformanceCountersInstaller installer = GetCommandLineConfiguredInstaller(firstCategory);

            DoCommitInstall(installer);

            Assert.IsTrue(PerformanceCounterCategory.Exists(firstCategory));

            PerformanceCountersInstaller uninstaller = GetCommandLineConfiguredInstaller(firstCategory);

            uninstaller.Uninstall(null);

            Assert.IsFalse(PerformanceCounterCategory.Exists(firstCategory));
        }
Example #2
0
 private void uninstallPerfCountersButton_Click(object sender, EventArgs e)
 {
     try
     {
         PerformanceCountersInstaller installer = new PerformanceCountersInstaller(new SystemConfigurationSource());
         installer.Context = new InstallContext();
         installer.Uninstall(null);
         MessageBox.Show("Performance counters have been successfully uninstalled.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }