public async void Execute(object parameter) { vm.resetAnswerColors(); /*Get the Questions*/ var temp = await QuestionsHelper.GetQuestions(vm); /*Clear the Questions array to make sure its empty before adding new values to it*/ vm.Questions.Clear(); /*Create a temp Oberservable Collection*/ ObservableCollection <Question> questions = new ObservableCollection <Question>(); /*Add the new questions to the temp array*/ foreach (var a in temp) { questions.Add(a); } /*Open the game window*/ vm.showGameWindow(); /*Sets the temp var to the real Questions List, cant be set directly, cause the INotifyPropChanged wouldnt trigger with * just adding values to a Observable Collection*/ vm.Questions = questions; /*Calculates the Questions left prop*/ vm.QuestionsLeftCount = vm.Questions.Count - 1; /*Lets game over be false*/ vm.GameOver = false; }
public void Execute(object parameter) { /*Increase the Current Question == go to the next question*/ vm.CurrentQuestion = new Question(); /*Reset the answer option colors*/ vm.resetAnswerColors(); vm.RoundOver = false; vm.QuestionsLeftCount--; vm.Answer = string.Empty; }