コード例 #1
0
        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;
            }
        }
コード例 #2
0
 private void DeviceLocked_DeviceWasLocked(object sender, DeviceLockedEventArgs e)
 {
     DeviceWasLocked?.Invoke(this, e);
 }
コード例 #3
0
 protected virtual void OnDeviceWasLocked(DeviceLockedEventArgs e)
 {
     New <IUIThread>().PostTo(() => DeviceWasLocked?.Invoke(this, e));
 }