예제 #1
0
 /// Free managed resources
 protected virtual void Dispose(bool disposing)
 {
     if (eventHandler != null)
     {
         NativeMethods.SetConsoleCtrlHandler(eventHandler, false);
         eventHandler = null;
     }
 }
예제 #2
0
 /// Constructor
 public ConsoleCtrl()
 {
     // save this to a private var so the GC doesn't collect it...
     if (Environment.OSVersion.Platform == PlatformID.Win32NT)
     {
         try
         {
             eventHandler = new NativeMethods.ConsoleControlEventHandler(handler);
             NativeMethods.SetConsoleCtrlHandler(eventHandler, true);
         }
         catch (System.EntryPointNotFoundException)
         {
             eventHandler = null;
         }
     }
 }
예제 #3
0
 /// Constructor
 public ConsoleCtrl()
 {
     // save this to a private var so the GC doesn't collect it...
     if (Environment.OSVersion.Platform == PlatformID.Win32NT)
     {
         try
         {
             eventHandler = new NativeMethods.ConsoleControlEventHandler(handler);
             NativeMethods.SetConsoleCtrlHandler(eventHandler, true);
         }
         catch (System.EntryPointNotFoundException)
         {
             eventHandler = null;
         }
     }
 }
예제 #4
0
 /// Free managed resources
 protected virtual void Dispose(bool disposing)
 {
     if (eventHandler != null)
     {
         NativeMethods.SetConsoleCtrlHandler(eventHandler, false);
         eventHandler = null;
     }
 }