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