public static async Task OutputMessageAsync(IAsyncServiceProvider serviceProvider, String message) { await TaskScheduler.Default; await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); OutputPane outputPane = OutputPane.Create(serviceProvider); OutputTimestamp(outputPane); outputPane.WriteLine(message); outputPane.WriteLine(""); }
public static async Task OutputExecutionResultAsync(IAsyncServiceProvider serviceProvider, String message, ExecutionResult result) { await TaskScheduler.Default; await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); OutputPane outputPane = OutputPane.Create(serviceProvider); OutputTimestamp(outputPane); outputPane.WriteLine(message); if (!String.IsNullOrEmpty(result.OutputData)) { outputPane.WriteLine("Output:"); outputPane.WriteLine(result.OutputData); } if (!String.IsNullOrEmpty(result.ErrorData)) { outputPane.WriteLine("Error:"); outputPane.WriteLine(result.ErrorData); } outputPane.WriteLine(""); }
private static void OutputTimestamp(OutputPane outputPane) { ThreadHelper.ThrowIfNotOnUIThread(); outputPane.Write($"[{DateTime.Now:HH:mm:ss}] "); }