protected override void SetKeepScreenOn(bool keepScreenOn) { if (KeepScreenOn == value) { return; } if (keepScreenOn) { IOKit.PreventUserIdleDisplaySleep("KeepScreenOn", out keepScreenOnId); } else { if (IOKit.AllowUserIdleDisplaySleep(keepScreenOnId)) { keepScreenOnId = 0; } } }
public void StartBatteryListeners() { powerSourceNotification = IOKit.CreatePowerSourceNotification(PowerSourceNotification); CFRunLoop.Current.AddSource(powerSourceNotification, CFRunLoop.ModeDefault); }
partial void ActivateScreenLock() { IOKit.PreventUserIdleDisplaySleep("DisplayRequest", out _displayRequestId); }
partial void DeactivateScreenLock() { IOKit.AllowUserIdleDisplaySleep(_displayRequestId); }