Exemplo n.º 1
0
        public static IEnumerable <WindowProcess> FromProcesses()
        {
            _allWindowsFinder.Refresh();

            var mainWindows = _allWindowsFinder.MainWindows;

            foreach (var process in Process.GetProcesses())
            {
                if (mainWindows.TryGetValue(process.Id, out var mainWindow) &&
                    !string.IsNullOrWhiteSpace(process.MainWindowTitle))
                {
                    var windowProcess = new WindowProcess(process, mainWindow);

                    if (!_ignoredExecutables.Contains(windowProcess.ExecutableName))
                    {
                        yield return(windowProcess);
                    }
                }
            }
        }
Exemplo n.º 2
0
 public IEnumerable <WindowProcess> GetWindowProcesses() =>
 WindowProcess.FromProcesses()
 .Where(process => process.ProcessId != _currentProcess.Id)
 .OrderBy(process => process.ProcessName)
 .ThenBy(process => process.MainWindowTitle);