private void ctrlEvent(object sender, ConsoleCtrlEventArgs consoleEvent) { consoleEvent.CallDefaultHandler = false; if (IgnoreCtrlC && consoleEvent.ConsoleEvent == ConsoleEvent.CtrlC) { return; } if (_timer == null) { _timer = new System.Threading.Timer(abortFunc, null, (long)AbortDelay.TotalMilliseconds, Timeout.Infinite); try { var ou = Output; if (ou != null) { ou.WriteLine("^C"); } var ab = Abort; ab.Invoke(this, new EventArgs()); _canExit.WaitOne(); Thread.Sleep(500); } catch { } } }
private bool handler(ConsoleEvent consoleEvent) { if (ControlEvent != null) { var a = new ConsoleCtrlEventArgs(consoleEvent); a.CallDefaultHandler = true; ControlEvent(this, a); return(!a.CallDefaultHandler); } return(false); }
private void ctrlEvent(object sender, ConsoleCtrlEventArgs consoleEvent) { consoleEvent.CallDefaultHandler = false; if (IgnoreCtrlC && consoleEvent.ConsoleEvent == ConsoleEvent.CtrlC) return; if (_timer == null) { _timer = new System.Threading.Timer(abortFunc, null, (long)AbortDelay.TotalMilliseconds, Timeout.Infinite); try { var ou = Output; if (ou != null) ou.WriteLine("^C"); var ab = Abort; ab.Invoke(this, new EventArgs()); _canExit.WaitOne(); Thread.Sleep(500); } catch { } } }
private bool handler(ConsoleEvent consoleEvent) { if (ControlEvent != null) { var a = new ConsoleCtrlEventArgs(consoleEvent); a.CallDefaultHandler = true; ControlEvent(this, a); return !a.CallDefaultHandler; } return false; }