private void LoadInstances(PerformanceCounterCategory category) { Collection <string> instances = PerfMonController.GetInstances(category); instance_ListBox.DataSource = instances; instance_ListBox.SelectedIndex = -1; counter_ListBox.DataSource = null; addCounter_ToolStripButton.Enabled = false; }
private void LoadInstances(PerformanceCounterCategory category) { Collection <string> instances = PerfMonController.GetInstances(category); instance_ListBox.DataSource = instances; //If there's only one instance, automatically select it and load the counters if (instances.Count == 1) { instance_ListBox.SelectedIndex = 0; instance_ListBox_SelectedIndexChanged(null, EventArgs.Empty); } else { instance_ListBox.SelectedIndex = -1; } }