Exemplo n.º 1
0
        public PowerNotificationService()
        {
            SystemEvents.PowerModeChanged += OnPowerModeChanged;
            RegisterClass(nameof(PowerNotificationService));
            var msgWinHandel = WindowMessageApiImports.CreateWindowEx(0, nameof(PowerNotificationService), "", 0, 0, 0, 0, 0, HwinConstants.HWND_MESSAGE, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);

            DeviceNotificationHelper.RegisterPowerSettingNotification(msgWinHandel);
        }
Exemplo n.º 2
0
        public DeviceChangedNotificationService()
        {
            SystemEvents.DisplaySettingsChanged += (_, _) => Debug.WriteLine("@@@@@@@@@@@@@@@@ Settings Changed");

            RegisterClass(nameof(DeviceChangedNotificationService));
            var msgWinHandel = WindowMessageApiImports.CreateWindowEx(0, nameof(DeviceChangedNotificationService), "", 0, 0, 0, 0, 0, HwinConstants.HWND_MESSAGE, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);

            DeviceNotificationHelper.RegisterMonitorDeviceNotification(msgWinHandel);
        }