public async static Task <ObservableCollection <QuestionDAO> > GetListQuestionChallenge(string listIdQuestion) { ObservableCollection <QuestionDAO> myList = new ObservableCollection <Models.QuestionDAO>(); try { Dictionary <string, string> myInfo = new Dictionary <string, string>(); myInfo.Add("listIdQuestion", listIdQuestion); var List = await App.MobileService.InvokeApiAsync("Question", HttpMethod.Get, myInfo); if (List != null) { myList.Clear(); foreach (var item in List) { myList.Add(new Models.QuestionDAO(item)); } return(myList); } return(null); } catch (Exception ex) { Debug.WriteLine("! ! ! Loading Question in Service ! ! ! " + ex.Message); return(ConnectServiceHelper.GetListQuestionChallenge(listIdQuestion).Result); } }
private async void LoadGame() { switch (Global.TypeGenre) { case "default": Global.ListQuestion = await ConnectServiceHelper.LoadListQuestion(); if (Global.ListQuestion != null) { NextQuestion(); } break; case "challenge": Global.ListQuestion = await ConnectServiceHelper.GetListQuestionChallenge(Global.CurrentChallenge.ListIdQuestion); if (Global.ListQuestion != null) { NextQuestion(); } break; default: Global.ListQuestion = await ConnectServiceHelper.LoadQuestionByGenre(Global.TypeGenre); if (Global.ListQuestion != null) { NextQuestion(); } break; } }