Exemple #1
0
 public void Stop()
 {
     if (_window == null)
     {
         return;
     }
     NativeMethods.UnregisterPowerSettingNotification(_ScreenStateNotify);
     _window.DestroyHandle();
     _window.ReleaseHandle();
     _window = null;
 }
Exemple #2
0
 public void Start()
 {
     if (_window != null)
     {
         return;
     }
     _window          = new EventNativeWindow();
     _window.Message += _window_Message;
     _window.CreateHandle(new CreateParams());
     _ScreenStateNotify = NativeMethods.RegisterPowerSettingNotification(
         _window.Handle,
         ref NativeMethods.GUID_CONSOLE_DISPLAY_STATE,
         NativeMethods.DEVICE_NOTIFY_WINDOW_HANDLE);
 }