private void LoadCounters() { PerformanceCounterCategory category = category_ListBox.SelectedItem as PerformanceCounterCategory; Collection <PerformanceCounter> counters = PerfMonController.GetCounters(category, SelectedInstance); counter_ListBox.DataSource = counters; counter_ListBox.DisplayMember = "CounterName"; counter_ListBox.SelectedIndex = -1; }
private void LoadCounters(string machineName) { if (_loadFromMachine) { string instanceName = SelectedInstance; PerformanceCounterCategory category = SelectedCategory as PerformanceCounterCategory; Collection <PerformanceCounter> counters = PerfMonController.GetCounters(category, instanceName); counter_ListBox.DataSource = counters; } else { ResourceWindowsCategory instance = null; using (EnterpriseTestContext context = new EnterpriseTestContext()) { instance = ResourceWindowsCategory.Select(context, ResourceWindowsCategoryType.PerfMon.ToString()).Where(c => c.Name == machineName).FirstOrDefault(); } counter_ListBox.DataSource = instance.Children; } counter_ListBox.DisplayMember = "Name"; counter_ListBox.SelectedIndex = -1; }