private void Session_UserAuthenticationInformationRequestReceived(object sender, MessageEventArgs <InformationRequestMessage> e) { var informationRequestMessage = e.Message; var eventArgs = new AuthenticationPromptEventArgs(Username, informationRequestMessage.Instruction, informationRequestMessage.Language, informationRequestMessage.Prompts); ThreadAbstraction.ExecuteThread(() => { try { if (AuthenticationPrompt != null) { AuthenticationPrompt(this, eventArgs); } var informationResponse = new InformationResponseMessage(); foreach (var response in from r in eventArgs.Prompts orderby r.Id ascending select r.Response) { informationResponse.Responses.Add(response); } // Send information response message _session.SendMessage(informationResponse); } catch (Exception exp) { _exception = exp; _authenticationCompleted.Set(); } }); }
/// <summary> /// Handles the MessageReceived event of the session. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The event data.</param> protected override void Session_MessageReceived(object sender, MessageEventArgs <Message> e) { var informationRequestMessage = e.Message as InformationRequestMessage; if (informationRequestMessage != null) { var eventArgs = new AuthenticationPromptEventArgs(this.Username, informationRequestMessage.Instruction, informationRequestMessage.Language, informationRequestMessage.Prompts); this.ExecuteThread(() => { try { if (this.AuthenticationPrompt != null) { this.AuthenticationPrompt(this, eventArgs); } var informationResponse = new InformationResponseMessage(); foreach (var response in from r in eventArgs.Prompts orderby r.Id ascending select r.Response) { informationResponse.Responses.Add(response); } // Send information response message this.SendMessage(informationResponse); } catch (Exception exp) { this._exception = exp; this._authenticationCompleted.Set(); } }); } }