async void getQuestionAnswers() { nextButton.IsVisible = false; activityIndicator.IsVisible = true; activityIndicator.IsRunning = true; //Console.WriteLine("NUMBER OF QUESTIONS" + survey.surveyQuestions.Count()); for (int i = 0; i < survey.surveyQuestions.Count(); i++) { string currentnumber = i.ToString(); /*surveyQuestion surveyQuestion = new surveyQuestion(); * surveyQuestion.questionID = survey.surveyQuestions[i].questionID; * surveyQuestion.questionTitle = survey.surveyQuestions[i].questionTitle; * surveyQuestion.questionType = survey.surveyQuestions[i].questionType; * surveyQuestion.surveyID = survey.surveyQuestions[i].surveyID;*/ List <surveyOption> surveyOptions = new List <surveyOption>(); /*if (survey.surveyQuestions[i].questionType == "shortsentence") * { * survey.surveyQuestions.Add(surveyQuestion); * }else if(survey.surveyQuestions[i].questionType == "longsentence") * { * survey.surveyQuestions.Add(surveyQuestion); * }else*/ if (survey.surveyQuestions[i].questionType == "dropdown" || survey.surveyQuestions[i].questionType == "radiobuttons" || survey.surveyQuestions[i].questionType == "checkboxes") { string httpTaskanswers = await Task.Run <string>(() => HttpRequestHandler.PostGetSurveyQuestionAnswers(survey.surveyQuestions[i].questionID)); while (httpTaskanswers == null) { httpTaskanswers = await Task.Run <string>(() => HttpRequestHandler.PostGetSurveyQuestionAnswers(survey.surveyQuestions[i].questionID)); } //if survey question dropdown/radiobutton/checkbox is available, get the list of answers for this particular question if (httpTaskanswers != null) { survey.surveyQuestions[i].surveyOptions = JsonConvert.DeserializeObject <List <surveyOption> >(httpTaskanswers.ToString()); } } } activityIndicator.IsVisible = false; activityIndicator.IsRunning = false; nextButton.IsVisible = true; }