예제 #1
0
        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("");
        }
예제 #2
0
        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("");
        }
예제 #3
0
 private static void OutputTimestamp(OutputPane outputPane)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     outputPane.Write($"[{DateTime.Now:HH:mm:ss}] ");
 }