private void StopImpl() { if(receiver != null) { if(receiver.IsHandleCreated) { receiver.Close(); receiver.Dispose(); GC.SuppressFinalize(receiver); receiver = null; } } }
public bool Start() { // check if we are running on Vista+ if(IsUnderVista() == false) { return false; } Debug.ReportWarning("Started listening to power notifications"); // show the window receiver = new PowerNotificationsReceiver(); receiver.Manager = this; if(_baseControl != null) { // WinForms start _baseControl.Invoke(new MethodInvoker(WinFormsStart)); } else { receiver.Show(); receiver.Start(); } return true; }