コード例 #1
0
            internal static ConsoleCancelEventArgs Console_CancelKeyPress()
            {
                var args = Activate <ConsoleCancelEventArgs>(ConsoleSpecialKey.ControlC);

                CancellationHandlers.Console_CancelKeyPress(new object(), args);
                return(args);
            }
コード例 #2
0
 internal static AppRunner UseCancellationHandlers(AppRunner appRunner)
 {
     return(appRunner.Configure(c =>
     {
         c.UseMiddleware(AddCancellationTokens, MiddlewareSteps.CancellationHandler);
         c.OnRunCompleted += args => CancellationHandlers.EndRun(args.CommandContext);
     }));
 }
コード例 #3
0
            internal static UnhandledExceptionEventArgs CurrentDomain_UnhandledException(bool isTerminating)
            {
                var ex   = new Exception("some random exception");
                var args = Activate <UnhandledExceptionEventArgs>(ex, isTerminating);

                CancellationHandlers.CurrentDomain_UnhandledException(new object(), args);
                return(args);
            }
コード例 #4
0
 private static Task <int> AddCancellationTokens(CommandContext ctx, ExecutionDelegate next)
 {
     CancellationHandlers.BeginRun(ctx);
     return(next(ctx));
 }
コード例 #5
0
 internal static void CurrentDomain_ProcessExit() =>
 CancellationHandlers.CurrentDomain_ProcessExit(new object(), EventArgs.Empty);