コード例 #1
0
 void OnUnlockAttempt(WorkstationUnlockResult result)
 {
     if (result.IsSuccessful)
     {
         WorkstationUnlockPerformed?.Invoke(this, result);
     }
 }
コード例 #2
0
        async Task TryUnlockWorkstation(IDevice device, string flowId, Action <WorkstationUnlockResult> onUnlockAttempt)
        {
            var result = new WorkstationUnlockResult();

            await _ui.SendNotification(TranslationSource.Instance["ConnectionFlow.Unlock.ReadingCredentials"], device.Mac);

            var credentials = await GetCredentials(device);

            // send credentials to the Credential Provider to unlock the PC
            await _ui.SendNotification(TranslationSource.Instance["ConnectionFlow.Unlock.Unlocking"], device.Mac);

            result.IsSuccessful = await _workstationUnlocker
                                  .SendLogonRequest(credentials.Login, credentials.Password, credentials.PreviousPassword);

            result.AccountName  = credentials.Name;
            result.AccountLogin = credentials.Login;
            result.DeviceMac    = device.Mac;
            result.FlowId       = flowId;

            onUnlockAttempt?.Invoke(result);

            if (!result.IsSuccessful)
            {
                throw new WorkstationUnlockFailedException(); // Abort connection flow
            }
        }
コード例 #3
0
        void ProximityProcessor_WorkstationUnlockPerformed(object sender, WorkstationUnlockResult e)
        {
            if (e.FlowId == _flowId)
            {
                FlowUnlockResult = e;
                UnlockMethod     = SessionSwitchSubject.Proximity;

                if (!FlowUnlockResult.IsSuccessful)
                {
                    _tcs.TrySetResult(new object());
                }
            }
        }