private void CancelKeyPressed(object sender, ConsoleCancelEventArgs e)
        {
            console.WriteEmptyLine();
            console.WriteLine("Ctrl + C hit. Shutting down.");

            Environment.Exit(-1);
        }
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     Log.TraceEvent(System.Diagnostics.TraceEventType.Stop, -1, "Ctrl+C received, stopping the gateway");
     e.Cancel = true;
     gateway.Dispose();
     Environment.Exit(0);
 }
Пример #3
0
 void InterruptEdit(object sender, ConsoleCancelEventArgs a)
 {
     // Do not abort our program
     a.Cancel = true;
     // ThreadAbortException will be thrown
     _mainThread.Abort();
 }
Пример #4
0
        public static void OnClose(object obj,ConsoleCancelEventArgs Args)
        {
            Log.Info("Fermeture", "Fermeture du serveur");

            WorldMgr.Stop();
            Player.Stop();
        }
Пример #5
0
 static void CtrlC_Handler(object sender, ConsoleCancelEventArgs args)
 {
     Console.WriteLine("\nCtrl-C");
     //cleanupCompleted.WaitOne();
     // prevent the process from exiting until cleanup is done:
     args.Cancel = true;
 }
Пример #6
0
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     System.Console.WriteLine("Cancel requested...");
     ServerEngine.Stop();
     System.Console.WriteLine("Ready to terminate");
     Thread.Sleep(100);
 }
Пример #7
0
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     e.Cancel = true;
     _s_stop = true;
     Console.Clear();
     Console.WriteLine("Closing...");
 }
Пример #8
0
        protected static void CancelEventHandler(object sender, ConsoleCancelEventArgs args)
        {
            ShutdownServer();

            while (true)
                Thread.Sleep(1);
        }
 private static void cancelStreamHandler(object sender, ConsoleCancelEventArgs e)
 {
     if (twitterConnection != null)
         twitterConnection.StopUserStreaming();
     ConsoleOutput.PrintMessage("All finished.", ConsoleColor.Blue);
     Thread.Sleep(TimeSpan.FromSeconds(1.3));
 }
Пример #10
0
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     if (e.SpecialKey == ConsoleSpecialKey.ControlC)
     {
         Shutdown();
     }
 }
Пример #11
0
        /// <summary>
        /// Handles Ctrl+C key presses.
        /// </summary>
        private void CancelKeyPressHandler(object sender, ConsoleCancelEventArgs e)
        {
            CancellationTokenSource.Cancel();

            // Allow the application to finish cleanup rather than terminating immediately
            e.Cancel = true;
        }
Пример #12
0
		private static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
		{
			e.Cancel=true;
			ConsoleColor color=Console.ForegroundColor;
			Console.ForegroundColor=ConsoleColor.Cyan;
			Console.WriteLine("Please input to close server.");
			Console.ForegroundColor=color;
		}
Пример #13
0
 private void Cancel(object sender, ConsoleCancelEventArgs e)
 {
     Console.WriteLine("(Ctrl + C)");
     e.Cancel = true;
     stopRead = true;
     mainThread.Join();
     Environment.Exit(0);
 }
Пример #14
0
 private static void Console_CancelKeyPress(Object sender, ConsoleCancelEventArgs e)
 {
     lock (SyncObject)
     {
         running = false;
     }
     e.Cancel = true;
 }
Пример #15
0
        private void ConsoleCancelKeyPress(object sender, ConsoleCancelEventArgs e)
        {
            e.Cancel = true;

            Console.WriteLine();
            Console.WriteLine("Please use '#q' to quit the loop.");
            Console.Write(">");
        }
Пример #16
0
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     //bye bye
     if (_stop != null)
     {
         _stop.Set();
     }
 }
Пример #17
0
 //Server Cancel Event
 public static void CancelEventHandler(object sender, ConsoleCancelEventArgs args)
 {
     LoginServerConnection.ShutdownServer();
     while (true)
     {
         Thread.Sleep(1);
     }
 }
Пример #18
0
 /*
    When you press CTRL+C, the read operation is interrupted and the
    console cancel event handler, myHandler, is invoked. Upon entry
    to the event handler, the Cancel property is false, which means
    the current process will terminate when the event handler terminates.
    However, the event handler sets the Cancel property to true, which
    means the process will not terminate and the read operation will resume.
 */
 protected static void CtrlC(object sender, ConsoleCancelEventArgs args)
 {
     Program.breakRunning = true;
     args.Cancel = false;
     Save();
     SaveProxyRest();
     ShowExecutingTime();
 }
Пример #19
0
 protected static void MyExitHandler(object sender, ConsoleCancelEventArgs args)
 {
     Console.WriteLine("MyExitHandler");
     nc.Disconnect();
     
     //args.Cancel = true;
     
 }
Пример #20
0
        private static void MyExitHandler(object sender, ConsoleCancelEventArgs args)
        {
            Console.WriteLine("ScenCon exiting...");
            c.Disconnect();

            //args.Cancel = true;

        }
Пример #21
0
 private static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     if (processor.State == ProcessorState.Busy)
     {
         e.Cancel = true;
         processor.Cancel();
     }
 }
Пример #22
0
        ///////////////////////////////////////////////////////////////////////
        private static void Console_CancelKeyPress(Object sender, ConsoleCancelEventArgs args)
        {
            _logger.Info("Program canceled by user");

            args.Cancel = true;

            _tiempo.Dispose();
            _apprun = false;
        }
Пример #23
0
        static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
        {
            System.Console.Error.WriteLine();
            System.Console.Error.WriteLine("Cancelling backup...");

            // Avoid CTRL+C during VSS snapshots
            cancel = true;
            e.Cancel = true;
        }
Пример #24
0
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     //you have 2 options here, leave e.Cancel set to false and just handle any
     //graceful shutdown that you can while in here, or set a flag to notify the other
     //thread at the next check that it's to shut down.  I'll do the 2nd option
     e.Cancel = true;
     _s_stop = true;
     Console.WriteLine("CancelKeyPress fired...");
 }
Пример #25
0
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     if (!secondCancel) {
         e.Cancel = true;
         secondCancel = true;
         Console.WriteLine("=========> Sending shutdown event. Press cancel key again to force quit.");
         _q.Enqueue(new ShutdownSignal());
     }
 }
Пример #26
0
 private static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     Logger.Warn("I'm exiting now because you force my hand!");
     if (_handler != null)
     {
         Logger.Warn("Cancelling handler!");
         _handler.Cancel();
     }
 }
Пример #27
0
 private static void ConsoleOnCancelKeyPress(object sender, ConsoleCancelEventArgs consoleCancelEventArgs)
 {
     if (_fixer != null)
     {
         _fixer.Stop();
     }
     _stop = true;
     consoleCancelEventArgs.Cancel = false;
 }
Пример #28
0
 private static void SignalExit(object sender, ConsoleCancelEventArgs args) {
     if (stopSignaled) {
         server.Log.Error("Recieved second exit signal, terminating");
     } else {
         server.Stop();
         stopSignaled = true;
         args.Cancel = true;
     }
 }
Пример #29
0
        private void ConsoleCancelKeyPress(object sender, ConsoleCancelEventArgs e)
        {
            _log.Info("Recieved Ctrl+C triggering stop on application component");

            e.Cancel = true;

            _component.Stop();

            _done = true;
        }
Пример #30
0
 /// <summary>
 /// Обработка нажатия Ctrl-C
 /// </summary>
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     // К сожалению, в связи с ошибкой в .NET Framework v4.0.30319 вы не можете олаживать это
     // потому что Visual Studio 2010 выдает ошибку "No Source Available".
     // http://connect.microsoft.com/VisualStudio/feedback/details/524889/debugging-c-console-application-that-handles-console-cancelkeypress-is-broken-in-net-4-0
     Console.SetCursorPosition(0, 19);
     Console.WriteLine("Нажата {0}, выход...", e.SpecialKey);
     quit = true;
     e.Cancel = true; // Установка в true позволяет на закрывать программу сразу
 }
Пример #31
0
        private static async void KeyPressHandler(object sender, System.ConsoleCancelEventArgs args)
        {
            await _logger.LogMessageAsync("\nThe read operation has been interrupted.");

            await _logger.LogMessageAsync($"  Key pressed: {args.SpecialKey}");

            await _logger.LogMessageAsync($"  Cancel property: {args.Cancel}");

            await _logger.LogMessageAsync("Setting the Cancel property to true...");

            args.Cancel = true;

            await _logger.LogMessageAsync($"  Cancel property: {args.Cancel}");

            await _logger.LogMessageAsync("The read operation will resume...\n");
        }
Пример #32
0
        private static void myHandler(object sender,
                                      System.ConsoleCancelEventArgs args)
        {
// Announce that the event handler has been invoked.
            Console.WriteLine("\nThe read operation has been interrupted.");

// Announce which key combination was pressed.
            Console.WriteLine("  Key pressed: {0}", args.SpecialKey);

// Announce the initial value of the Cancel property.
            Console.WriteLine("  Cancel property: {0}", args.Cancel);

// Set the Cancel property to true to prevent the process from terminating.
            Console.WriteLine("Setting the Cancel property to true...");
            args.Cancel = true;

// Announce the new value of the Cancel property.
            Console.WriteLine("  Cancel property: {0}", args.Cancel);
            Console.WriteLine("The read operation will resume...\n");

            saw_keyboard_interrupt = true;
        }
Пример #33
0
 private void Console_CancelKeyPress(object sender, System.ConsoleCancelEventArgs e)
 {
     e.Cancel = true;
     Logger.LogInformation("Escreva 'exit' para encerrar a aplicação");
 }
Пример #34
0
 static void OnCancelKeyPress(object sender, System.ConsoleCancelEventArgs e)
 {
     running = false;
     Console.WriteLine("Quit");
 }