示例#1
0
        private static void RegisterConsoleControlHandler()
        {
#if !NETSTANDARD2_0
            _consoleCtrlHandler = new ConsoleCtrlMessageHandler(ConsoleCtrlHandler);
            GC.KeepAlive((object)_consoleCtrlHandler);
            SetConsoleCtrlHandler(_consoleCtrlHandler, true);
#endif
        }
示例#2
0
 internal static void RegisterConsoleControlHandler()
 {
     if (!ChoConsoleSettings.Me.DisableConsoleCtrlHandler)
     {
         _consoleCtrlHandler = new ConsoleCtrlMessageHandler(ConsoleCtrlHandler);
         GC.KeepAlive(_consoleCtrlHandler);
         ChoKernel32.SetConsoleCtrlHandler(_consoleCtrlHandler, true);
     }
 }
示例#3
0
        // A private static handler function in the MyApp class.
        internal static bool ConsoleCtrlHandler(CtrlTypes ctrlType)
        {
            ConsoleCtrlMessageHandler consoleCtrlMessageHandler = ChoApplicationHost.ConsoleCtrlMessageReceived;

            if (consoleCtrlMessageHandler != null)
            {
                return(consoleCtrlMessageHandler(ctrlType));
            }
            else
            {
                return(OnConsoleCtrlMessage(ctrlType));
            }
        }
示例#4
0
 internal static extern bool SetConsoleCtrlHandler(ConsoleCtrlMessageHandler consoleCtrlRoutine, bool Add);
示例#5
0
 private static void RegisterConsoleControlHandler()
 {
     _consoleCtrlHandler = new ConsoleCtrlMessageHandler(ConsoleCtrlHandler);
     GC.KeepAlive((object)_consoleCtrlHandler);
     SetConsoleCtrlHandler(_consoleCtrlHandler, true);
 }