public async Task postUpdatedMessage() { try { await vm.ShowLoader(); if (App.buttonClick == 0) { App.buttonClick++; var client = new HttpClient(); HttpClient hc = new HttpClient(); var response1 = await hc.GetStringAsync(Config.COMMENT_INFO_URL + requirementId); var obj = JsonConvert.DeserializeObject <CommentsInfoModel>(response1); //if (userListPicker.SelectedIndex != -1) //{ var values = new Dictionary <object, object> { { "lastMessage", obj.lastMessage }, { "lastPostDate", obj.lastPostDate }, { "lastPostBy", obj.lastPostBy }, { "requirementId", obj.requirementId }, { "reqDefinitionId", obj.reqDefinitionId }, { "reqDealId", obj.reqDealId }, { "requirementDealId", obj.requirementDealId }, { "documentDefinitionId", obj.documentDefinitionId }, { "documentDefinitionName", obj.documentDefinitionName }, { "documentId", obj.documentId }, { "primaryDocumentName", obj.primaryDocumentName }, { "statusDescription", obj.statusDescription }, { "status", statusUpdatedTxt }, { "description", obj.description }, { "name", obj.name }, { "type", obj.type }, { "reqType", obj.reqType }, { "typeCode", obj.typeCode }, { "valueLabel", obj.valueLabel }, { "compareFlag", obj.compareFlag }, { "showCompareFlag", obj.showCompareFlag }, { "expectedValue", obj.expectedValue }, { "actualValue", obj.actualValue }, { "actualValueEnabled", obj.actualValueEnabled }, { "active", obj.active }, { "manualRequirement", obj.manualRequirement }, { "dueDate", obj.dueDate }, { "asOfDate", obj.asOfDate }, { "expirationDate", obj.expirationDate }, { "sourceCode", obj.sourceCode }, { "source", obj.source }, { "entityType", obj.entityType }, { "initiateProcessId", obj.initiateProcessId }, { "processHistoryId", obj.processHistoryId }, { "processId", obj.processId }, { "stageId", obj.stageId }, { "functionId", functionIdTxt }, { "processStageFunctionId", processStageFunctionIdTxt }, { "deferStageName", obj.deferStageName }, { "stageName", obj.stageName }, { "stageStatus", obj.stageStatus }, { "assignedTo", obj.assignedTo }, { "assignedToFullName", obj.assignedToFullName }, { "createdBy", obj.createdBy }, { "deferToStage", obj.deferToStage }, { "comment", obj.comment }, { "compareDataType", obj.compareDataType }, { "compareFunctionName", obj.compareFunctionName }, { "exception", obj.exception }, { "complete", obj.complete }, { "daysDue", obj.daysDue }, { "group", obj.group }, { "requireDocument", obj.requireDocument }, { "missingDocument", obj.missingDocument }, { "requireAsOfDate", obj.requireAsOfDate }, { "expirationPeriodDays", obj.expirationPeriodDays }, { "priority", obj.priority }, { "exceptionFlag", obj.exceptionFlag }, { "mitigatingFactors", obj.mitigatingFactors }, { "stageType", obj.stageType }, { "isAttention", obj.isAttention }, { "attentionType", obj.attentionType }, { "actionType", typeUpdatedTxt }, { "createdDate", obj.createdDate }, { "lastModBy", userId }, { "lastModByDate", currentDateTime }, { "apReqNeededforclosing", obj.apReqNeededforclosing }, { "coProcessNeededforclosing", obj.coProcessNeededforclosing }, { "isSubjectTo", obj.isSubjectTo }, { "isMitigatingFactors", obj.isMitigatingFactors }, { "subjectTo", obj.subjectTo }, { "loanRequestType", obj.loanRequestType }, { "dealId", obj.dealId }, { "isSaveComplete", obj.isSaveComplete }, { "lastModbyFirstname", obj.lastModbyFirstname }, { "lastModbyLastname", obj.lastModbyLastname }, { "documentCount", obj.documentCount }, { "hardstop", obj.hardstop }, { "statusType", obj.statusType }, { "frequentlyUsed", obj.frequentlyUsed }, { "isTickler", obj.isTickler }, { "threadId", obj.threadId }, }; string url = Config.POST_UPDATED_COMMENTS + notifyDefinitionTxt; var content1 = new StringContent(JsonConvert.SerializeObject(values), Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content1); if (response.StatusCode != System.Net.HttpStatusCode.OK || response.Content == null) { Device.BeginInvokeOnMainThread(async() => { await DisplayAlert("Data Not Sent!!", string.Format("Response contained status code: {0}", response.StatusCode), "OK"); }); } else { var content = await response.Content.ReadAsStringAsync(); Debug.WriteLine(content); await ShowMessage("Simon", content, "OK", async() => { await Navigation.PopToRootAsync(); }); //await DisplayAlert("Simon", content, "OK", "Cancel"); // the call is awaited //// the execution is stopped here, the next line won't be executed until the user chooses Yes or No //if (yesSelected) // No compile error, as the result will be bool, since we awaited the Task<bool> //{ // await Navigation.PopToRootAsync(); //} //else //{ return; } } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } finally { await BaseViewModel.ClosePopup(); } }