public void Free()
 {
     busy = false;
     var res = ConsoleImports.SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);
 }
 public void RemoveHandler()
 {
     var res = ConsoleImports.SetConsoleCtrlHandler(null, false);
 }
 public void Busy()
 {
     busy = true;
     var res = ConsoleImports.SetConsoleCtrlHandler(null, false);
 }
        public void SetHandler()
        {
            var res = ConsoleImports.SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);

            Console.CancelKeyPress += HandleConsole_CancelKeyPress;
        }