private async void DeviceWasLocked(object sender, DeviceLockedEventArgs e) { if (!New <IUIThread>().IsOn) { throw new InternalErrorException("Must be on UI thread to handle device locking events."); } switch (e.Reason) { case DeviceLockReason.Permanent: if (_currentLock != DeviceLockReason.None && _currentLock != DeviceLockReason.Temporary) { break; } _currentLock = DeviceLockReason.Permanent; try { await _permanentLocking(); } finally { _currentLock = DeviceLockReason.None; } break; case DeviceLockReason.Temporary: if (_currentLock != DeviceLockReason.None) { break; } if (New <UserSettings>().InactivitySignOutTime == TimeSpan.Zero) { return; } _currentLock = DeviceLockReason.Temporary; try { await _temporaryLocking(); } finally { _currentLock = DeviceLockReason.None; } break; default: break; } }
private void DeviceLocked_DeviceWasLocked(object sender, DeviceLockedEventArgs e) { DeviceWasLocked?.Invoke(this, e); }
protected virtual void OnDeviceWasLocked(DeviceLockedEventArgs e) { New <IUIThread>().PostTo(() => DeviceWasLocked?.Invoke(this, e)); }