コード例 #1
0
        private void CancelKeyPressed(object sender, ConsoleCancelEventArgs e)
        {
            console.WriteEmptyLine();
            console.WriteLine("Ctrl + C hit. Shutting down.");

            Environment.Exit(-1);
        }
コード例 #2
0
 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
ファイル: SecureStringReader.cs プロジェクト: mauve/Pash
 void InterruptEdit(object sender, ConsoleCancelEventArgs a)
 {
     // Do not abort our program
     a.Cancel = true;
     // ThreadAbortException will be thrown
     _mainThread.Abort();
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: Necrosummon/WarEmu
        public static void OnClose(object obj,ConsoleCancelEventArgs Args)
        {
            Log.Info("Fermeture", "Fermeture du serveur");

            WorldMgr.Stop();
            Player.Stop();
        }
コード例 #5
0
ファイル: GZip.cs プロジェクト: Belxjander/Asuna
 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
ファイル: Global.cs プロジェクト: timothypratley/Strive.NET
 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
ファイル: Program.cs プロジェクト: mdxbhmt/taticlearn
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     e.Cancel = true;
     _s_stop = true;
     Console.Clear();
     Console.WriteLine("Closing...");
 }
コード例 #8
0
ファイル: GameServer.cs プロジェクト: ZettaZero/TeraEmulator
        protected static void CancelEventHandler(object sender, ConsoleCancelEventArgs args)
        {
            ShutdownServer();

            while (true)
                Thread.Sleep(1);
        }
コード例 #9
0
 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
ファイル: Program.cs プロジェクト: ExpTeam/trunk
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     if (e.SpecialKey == ConsoleSpecialKey.ControlC)
     {
         Shutdown();
     }
 }
コード例 #11
0
ファイル: CliTaskHandler.cs プロジェクト: nano-byte/common
        /// <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
ファイル: Program.cs プロジェクト: 247321453/YgoServer
		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
ファイル: Worker.cs プロジェクト: KorniltsevMikhail/testTask
 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
ファイル: Program.cs プロジェクト: gahadzikwa/GAPP
 static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     //bye bye
     if (_stop != null)
     {
         _stop.Set();
     }
 }
コード例 #17
0
ファイル: LoginServer.cs プロジェクト: arkanoid1/Temu
 //Server Cancel Event
 public static void CancelEventHandler(object sender, ConsoleCancelEventArgs args)
 {
     LoginServerConnection.ShutdownServer();
     while (true)
     {
         Thread.Sleep(1);
     }
 }
コード例 #18
0
ファイル: Program.cs プロジェクト: amavr/datascraper
 /*
    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
ファイル: Program.cs プロジェクト: wshanshan/DDD
 protected static void MyExitHandler(object sender, ConsoleCancelEventArgs args)
 {
     Console.WriteLine("MyExitHandler");
     nc.Disconnect();
     
     //args.Cancel = true;
     
 }
コード例 #20
0
ファイル: Adams Program.cs プロジェクト: wshanshan/DDD
        private static void MyExitHandler(object sender, ConsoleCancelEventArgs args)
        {
            Console.WriteLine("ScenCon exiting...");
            c.Disconnect();

            //args.Cancel = true;

        }
コード例 #21
0
ファイル: Program.cs プロジェクト: vitalyobukhov/Flac2Alac
 private static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
 {
     if (processor.State == ProcessorState.Busy)
     {
         e.Cancel = true;
         processor.Cancel();
     }
 }
コード例 #22
0
ファイル: Program.cs プロジェクト: jheddings/tiempo
        ///////////////////////////////////////////////////////////////////////
        private static void Console_CancelKeyPress(Object sender, ConsoleCancelEventArgs args)
        {
            _logger.Info("Program canceled by user");

            args.Cancel = true;

            _tiempo.Dispose();
            _apprun = false;
        }
コード例 #23
0
ファイル: Program.cs プロジェクト: wegli/hypervbackup
        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
ファイル: Program.cs プロジェクト: ninnemana/ImageSearcher
 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
ファイル: Program.cs プロジェクト: Rafa652/IRCQueueBot
 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
ファイル: Program.cs プロジェクト: kjelliverb/condep-cli
 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
ファイル: Program.cs プロジェクト: bentayloruk/Flux
 private static void ConsoleOnCancelKeyPress(object sender, ConsoleCancelEventArgs consoleCancelEventArgs)
 {
     if (_fixer != null)
     {
         _fixer.Stop();
     }
     _stop = true;
     consoleCancelEventArgs.Cancel = false;
 }
コード例 #28
0
ファイル: Program.cs プロジェクト: kevtham/twin
 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
ファイル: Program.cs プロジェクト: saniainf/ConsoleTest
 /// <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
ファイル: Exn.cs プロジェクト: zen3d/larceny
        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");
 }