private void DoProcessSelected(object sender, SelectionChangedEventArgs e) { var selectedItem = ProcessNameListBox.SelectedItem; if (selectedItem != null) { m_keyStrings = new List <String>(); m_selectedKeys = new List <string>(); m_providerNames = new List <String>(); m_selectedProvider = null; m_providerNames = new List <String>(); if (selectedItem.ToString() == "*") { foreach (Guid guid in TraceEventProviders.GetPublishedProviders()) { m_providerNames.Add(TraceEventProviders.GetProviderName(guid)); } } else { //if (selectedItem.ToString() == "*") // TemplateProperty; // else m_selectedProcess = selectedItem.ToString(); int begin = m_selectedProcess.IndexOf("|"); int end = m_selectedProcess.IndexOf("| Alive", begin + 1); m_selectedProcess = m_selectedProcess.Substring(begin + 8, end - begin - 8); foreach (var provider in TraceEventProviders.GetRegisteredProvidersInProcess(int.Parse(m_selectedProcess))) { m_providerNames.Add(TraceEventProviders.GetProviderName(provider)); } KeyNameListBox.ItemsSource = m_keyStrings; } ProviderNameListBox.ItemsSource = m_providerNames; updateDisplays(); } }
private static void GetRegisteredProvidersInProcess() { new List <string>(TraceEventProviders.GetRegisteredProvidersInProcess(System.Diagnostics.Process.GetCurrentProcess().Id) .Select(p => TraceEventProviders.GetProviderName(p))).ForEach(name => Debug.WriteLine(name)); }
public static bool ProcessCanBeMonitored(int processId) { return(TraceEventProviders .GetRegisteredProvidersInProcess(processId) .Contains(WcfProviderGuid)); }
static void GetRegisteredProvidersInProcess() => TraceEventProviders.GetRegisteredProvidersInProcess(System.Diagnostics.Process.GetCurrentProcess().Id) .Select(TraceEventProviders.GetProviderName) .ForEach(name => Debug.WriteLine(name));