private async Task ExecuteLoadGameCommand() { if (IsBusy) return; try { IsBusy = true; if (game == null) { await Task.Run(() => { game = JsonConvert.DeserializeObject<Game>(FileCache.ReadGameData()); }); } Prize = game.Prize; OnPropertyChanged("Prize"); } finally { IsBusy = false; } }
private async Task ExecuteLoadQuestCommand() { if (IsBusy) return; try { IsBusy = true; Settings.QuestDone = false; QuestComplete = false; if (game == null) { await Task.Run(() => { game = JsonConvert.DeserializeObject<Game>(FileCache.ReadGameData()); }); } if (Settings.CurrentQuest >= game.Quests.Count) { Settings.GameCompleted = true; GameComplete = true;//trigger game complete ExtraTaskVisible = true; Quest = new Quest { Major = -1, Beacons = new List<Beacon>(), Clue = new Clue { Image = "http://blog.xamarin.com/wp-content/uploads/2014/01/evolve-2014.png", Message = "Congratulations, you have completed the Evolve 2014 Quest!" } }; OnPropertyChanged(CompletionDisplayPropertyName); OnPropertyChanged("Beacon1Visible"); OnPropertyChanged("Beacon2Visible"); OnPropertyChanged("Beacon3Visible"); return; } Quest = game.Quests.FirstOrDefault(p => p.Id == Settings.CurrentQuest); CheckEndQuest(); OnPropertyChanged(CompletionDisplayPropertyName); OnPropertyChanged("Beacon1Visible"); OnPropertyChanged("Beacon2Visible"); OnPropertyChanged("Beacon3Visible"); } finally { IsBusy = false; } }