private void NextQuestion() { jokerDisplay.Children.Clear(); var quest = LevelPlayViewModel.GetNextQuestion(); lblInfo.Text = ActualQuest; if (quest == null) { var lvl = LevelPlayViewModel.LevelViewModel.Levels.Where(x => x.IdLevel == LevelPlayViewModel.Level.IdLevel + 1).FirstOrDefault(); if (lvl != null) { lvl.IsLocked = false; } LevelPlayViewModel.WriteLevelDone(LevelPlayViewModel.Level.Questions, LevelPlayViewModel.Level.IdLevel, LevelPlayViewModel.MaxLevelId); IsBusy = true; Maingrid.IsEnabled = false; adIntersticial.LoadAd(); //write to DB } else { LblQuestion.Text = LevelPlayViewModel.GetActualQuestion().QuestionText; actualOptions = LevelPlayViewModel.GetActualQuestion().Options.OrderBy((item) => _rnd.Next()).ToList(); listOptions.ItemsSource = actualOptions; } }
public LevelPlayPage(LevelPlayViewModel lvlVM, JokersModel jokers) { InitializeComponent(); adIntersticial = DependencyService.Get <IAdIntersticial>(); adIntersticial.Init(this); Jokers = jokers; _rnd = new Random(); LevelPlayViewModel = lvlVM; LblQuestion.Text = LevelPlayViewModel.GetActualQuestion().QuestionText; actualOptions = LevelPlayViewModel.GetActualQuestion().Options.OrderBy((item) => _rnd.Next()).ToList(); listOptions.ItemsSource = actualOptions; listOptions.ItemClickCommand = ItemClickCommand; var fiftyTapRecognizer = new TapGestureRecognizer { Command = new Command(OnFiftyFifty), NumberOfTapsRequired = 1 }; fiftyfiftyImg.GestureRecognizers.Add(fiftyTapRecognizer); var peopleTapRecognizer = new TapGestureRecognizer { Command = new Command(OnPeopleTap), NumberOfTapsRequired = 1 }; peopleImg.GestureRecognizers.Add(peopleTapRecognizer); var phoneTapRecognizer = new TapGestureRecognizer { Command = new Command(OnPhoneTap), NumberOfTapsRequired = 1 }; phoneImg.GestureRecognizers.Add(phoneTapRecognizer); BindingContext = this; }