Ejemplo n.º 1
0
            internal static ConsoleCancelEventArgs Console_CancelKeyPress()
            {
                var args = Activate <ConsoleCancelEventArgs>(ConsoleSpecialKey.ControlC);

                CancellationHandlers.Console_CancelKeyPress(new object(), args);
                return(args);
            }
Ejemplo n.º 2
0
 internal static AppRunner UseCancellationHandlers(AppRunner appRunner)
 {
     return(appRunner.Configure(c =>
     {
         c.UseMiddleware(AddCancellationTokens, MiddlewareSteps.CancellationHandler);
         c.OnRunCompleted += args => CancellationHandlers.EndRun(args.CommandContext);
     }));
 }
Ejemplo n.º 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);
            }
Ejemplo n.º 4
0
 private static Task <int> AddCancellationTokens(CommandContext ctx, ExecutionDelegate next)
 {
     CancellationHandlers.BeginRun(ctx);
     return(next(ctx));
 }
Ejemplo n.º 5
0
 internal static void CurrentDomain_ProcessExit() =>
 CancellationHandlers.CurrentDomain_ProcessExit(new object(), EventArgs.Empty);