Пример #1
0
        protected override void SetKeepScreenOn(bool keepScreenOn)
        {
            if (KeepScreenOn == value)
            {
                return;
            }

            if (keepScreenOn)
            {
                IOKit.PreventUserIdleDisplaySleep("KeepScreenOn", out keepScreenOnId);
            }
            else
            {
                if (IOKit.AllowUserIdleDisplaySleep(keepScreenOnId))
                {
                    keepScreenOnId = 0;
                }
            }
        }
Пример #2
0
 public void StartBatteryListeners()
 {
     powerSourceNotification = IOKit.CreatePowerSourceNotification(PowerSourceNotification);
     CFRunLoop.Current.AddSource(powerSourceNotification, CFRunLoop.ModeDefault);
 }
Пример #3
0
 partial void ActivateScreenLock()
 {
     IOKit.PreventUserIdleDisplaySleep("DisplayRequest", out _displayRequestId);
 }
Пример #4
0
 partial void DeactivateScreenLock()
 {
     IOKit.AllowUserIdleDisplaySleep(_displayRequestId);
 }