public static void SetCloseHandler(Action handler) { SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true); s_handler = handler; }