Exemplo n.º 1
0
        private void RefreshApplications()
        {
            var processes = Process.GetProcesses().Where(x => x.MainWindowHandle != IntPtr.Zero).OrderBy(x => x.ProcessName);

            if (RunningApplications == null)
            {
                RunningApplications = new ObservableRangeCollection <Process>(processes);
            }
            else
            {
                RunningApplications.ReplaceRange(processes);
            }
            if (!string.IsNullOrEmpty(SelectedProcessName))
            {
                var process = processes.Where(x => x.ProcessName == SelectedProcessName);
                if (process != null && process.Count() == 1)
                {
                    SelectedProcess = process.First();
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Provides information about running applications on a PC.
 /// </summary>
 /// <returns>The titles of the main windows of running applications.</returns>
 private static IEnumerable <string> GetInfoAboutRunningApps()
 {
     return(RunningApplications.GetListOfRunningApps());
 }