Esempio n. 1
0
        public PowerBroadcasts(PowerSettingsNotification notifications, PowerEventProvider provider)
        {
            this.notificationHandles     = new Dictionary <PowerSettingsNotification, IntPtr>();
            this.provider                = provider;
            this.provider.EventReceived += provider_EventReceived;

            RegisterNotifications(notifications);
        }
Esempio n. 2
0
        private void Dispose(bool disposeManagedResources)
        {
            if (!disposed)
            {
                if (disposeManagedResources)
                {
                    if (this.provider != null)
                    {
                        this.provider.Dispose();
                        this.provider = null;
                    }
                }

                foreach (IntPtr handle in this.notificationHandles.Values)
                {
                    NativeMethods.UnregisterPowerSettingNotification(handle);
                }

                disposed = true;
            }
        }
Esempio n. 3
0
 public PowerBroadcasts(PowerEventProvider provider)
     : this(PowerSettingsNotification.None, provider)
 {
 }