背景:我正在努力将命令行和批处理功能添加到现有的WPFWindows应用程序。当我在启动时检测到一些选项时,我会抑制窗口出现,进行一些处理并立即退出。现在,因为没有UI,所以我想将一些消息输出到stdout/stderr。考虑以下代码:namespaceWpfConsoleTest{publicpartialclassApp:Application{protectedoverridevoidOnStartup(StartupEventArgse){Console.WriteLine("Start");System.Threading.Thread.Sleep(1000);Console
背景:我正在努力将命令行和批处理功能添加到现有的WPFWindows应用程序。当我在启动时检测到一些选项时,我会抑制窗口出现,进行一些处理并立即退出。现在,因为没有UI,所以我想将一些消息输出到stdout/stderr。考虑以下代码:namespaceWpfConsoleTest{publicpartialclassApp:Application{protectedoverridevoidOnStartup(StartupEventArgse){Console.WriteLine("Start");System.Threading.Thread.Sleep(1000);Console