public static async Task <ObservableCollection <QuestionDAO> > LoadListQuestion() { ObservableCollection <QuestionDAO> myList = new ObservableCollection <Models.QuestionDAO>(); try { var List = await App.MobileService.InvokeApiAsync("Question", HttpMethod.Get, null); if (List != null) { myList.Clear(); foreach (var item in List) { myList.Add(new Models.QuestionDAO(item)); } return(myList); // NextQuestion(); } myList.Clear(); return(myList); } catch (Exception ex) { Debug.WriteLine("! ! ! Loading Question in Service ! ! ! " + ex.Message); return(ConnectServiceHelper.LoadListQuestion().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; } }