public static void LogAsTableView(List <IWindow> windows, ITestOutputHelper logger) { var options = new LoggerTableOptions { OutputTo = new TestOutputAdapter(logger), Columns = new List <string> { "Handle", "Class Name", "Title", "Process Name", "ProcessId" } }; var tableLogger = new TableLogger(options); windows.ForEach(win => { tableLogger.AddRow(win.Handle, win.ClassName.Truncate(40, ""), win.Title.Truncate(40, ""), win.ProcessName.Truncate(30, ""), win.ProcessId); }); tableLogger.Write(Format.Minimal); logger.WriteLine($"Windows found: {windows.Count}"); }
private static void WriteToConsole(WindowService windowService, bool includeStyleFlags) { var watch = new Stopwatch(); watch.Start(); var windows = windowService.GetWindows(includeStyleFlags); var options = new LoggerTableOptions { Columns = new List <string> { "Handle", "Class Name", "Title", "Process Name", "ProcessId", "Process Arguments", "Styles", "ExtStyles" } }; var tableLogger = new TableLogger(options); windows.ToList().ForEach(win => tableLogger.AddRow(win.Handle, win.ClassName.Truncate(70, ""), win.Title.Truncate(70, ""), win.ProcessName.Truncate(30, ""), win.ProcessId, win.ProcessArguments.Truncate(120), string.Join(',', win.Styles), string.Join(',', win.ExtendedStyles))); tableLogger.Write(Format.Minimal); watch.Stop(); Console.Out.WriteLine($"Windows found: {windows.Count}. Search time: {watch.ElapsedMilliseconds / 1000}.{watch.ElapsedMilliseconds % 1000} seconds."); }