public void SubmitQuestionnaireAsync(Questionnaire questionnaire, Action<IOperationResult> callback) { this.service.BeginSubmitResponses( questionnaire, (ar) => { var operationResult = new OperationResult(); try { this.service.EndSubmitResponses(ar); } catch (Exception ex) { operationResult.Error = ex; } synchronizationContext.Post( (state) => { callback(operationResult); }, null); }, null); }
public void GetQuestionnaireAsync(Action<IOperationResult<Questionnaire>> callback) { IAsyncResult asyncResult = this.service.BeginGetQuestionnaire( (ar) => { OperationResult<Questionnaire> operationResult = new OperationResult<Questionnaire>(); try { operationResult.Result = service.EndGetQuestionnaire(ar); } catch (Exception ex) { operationResult.Error = ex; } synchronizationContext.Post( (state) => { callback(operationResult); }, null); }, null); }