本文整理汇总了C#中System.ConsoleCancelEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ConsoleCancelEventArgs类的具体用法?C# ConsoleCancelEventArgs怎么用?C# ConsoleCancelEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConsoleCancelEventArgs类属于System命名空间,在下文中一共展示了ConsoleCancelEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CancelKeyPressHandler
/// <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;
}
示例2: CtrlC_Handler
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;
}
示例3: Console_CancelKeyPress
static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
System.Console.WriteLine("Cancel requested...");
ServerEngine.Stop();
System.Console.WriteLine("Ready to terminate");
Thread.Sleep(100);
}
示例4: Console_CancelKeyPress
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);
}
示例5: InterruptEdit
void InterruptEdit(object sender, ConsoleCancelEventArgs a)
{
// Do not abort our program
a.Cancel = true;
// ThreadAbortException will be thrown
_mainThread.Abort();
}
示例6: OnClose
public static void OnClose(object obj,ConsoleCancelEventArgs Args)
{
Log.Info("Fermeture", "Fermeture du serveur");
WorldMgr.Stop();
Player.Stop();
}
示例7: Console_CancelKeyPress
static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
e.Cancel = true;
_s_stop = true;
Console.Clear();
Console.WriteLine("Closing...");
}
示例8: CancelEventHandler
protected static void CancelEventHandler(object sender, ConsoleCancelEventArgs args)
{
ShutdownServer();
while (true)
Thread.Sleep(1);
}
示例9: cancelStreamHandler
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: Console_CancelKeyPress
static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
if (e.SpecialKey == ConsoleSpecialKey.ControlC)
{
Shutdown();
}
}
示例11: CancelKeyPressed
private void CancelKeyPressed(object sender, ConsoleCancelEventArgs e)
{
console.WriteEmptyLine();
console.WriteLine("Ctrl + C hit. Shutting down.");
Environment.Exit(-1);
}
示例12: Console_CancelKeyPress
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: Cancel
private void Cancel(object sender, ConsoleCancelEventArgs e)
{
Console.WriteLine("(Ctrl + C)");
e.Cancel = true;
stopRead = true;
mainThread.Join();
Environment.Exit(0);
}
示例14: Console_CancelKeyPress
private static void Console_CancelKeyPress(Object sender, ConsoleCancelEventArgs e)
{
lock (SyncObject)
{
running = false;
}
e.Cancel = true;
}
示例15: ConsoleCancelKeyPress
private void ConsoleCancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
e.Cancel = true;
Console.WriteLine();
Console.WriteLine("Please use '#q' to quit the loop.");
Console.Write(">");
}