void OnUnlockAttempt(WorkstationUnlockResult result) { if (result.IsSuccessful) { WorkstationUnlockPerformed?.Invoke(this, result); } }
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 } }
void ProximityProcessor_WorkstationUnlockPerformed(object sender, WorkstationUnlockResult e) { if (e.FlowId == _flowId) { FlowUnlockResult = e; UnlockMethod = SessionSwitchSubject.Proximity; if (!FlowUnlockResult.IsSuccessful) { _tcs.TrySetResult(new object()); } } }