protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (this.DataContext is WordsWithTheSameLengthViewModel) { _model = (WordsWithTheSameLengthViewModel)this.DataContext; if (_model.SelectedTopN == 10) { RadioButtonTenWords.Checked -= TenRadioButtonChecked; RadioButtonTenWords.IsChecked = true; RadioButtonTenWords.Checked += TenRadioButtonChecked; } else if (_model.SelectedTopN == 30) { RadioButtonThirdWords.Checked -= ThirdRadioButtonChecked; RadioButtonThirdWords.IsChecked = true; RadioButtonThirdWords.Checked += ThirdRadioButtonChecked; } else if (_model.SelectedTopN == 50) { RadioButtonFiftyWords.Checked -= FiftyRadioButtonChecked; RadioButtonFiftyWords.IsChecked = true; RadioButtonFiftyWords.Checked += FiftyRadioButtonChecked; } else if (_model.SelectedTopN == 100) { RadioButtonHundredWords.Checked -= HundredRadioButtonChecked; RadioButtonHundredWords.IsChecked = true; RadioButtonHundredWords.Checked += HundredRadioButtonChecked; } else if (_model.SelectedTopN == 200) { RadioButtonTwoHundredWords.Checked -= TwoHundredRadioButtonChecked; RadioButtonTwoHundredWords.IsChecked = true; RadioButtonTwoHundredWords.Checked += TwoHundredRadioButtonChecked; } await _model.ShowSelectedNumberOfWordsAsync(); if (ScrollViewerWordsFilledView.Visibility == Visibility.Visible) { lstWordsFilledView.ItemsSource = _model.Words; } else if (ScrollViewerWordsFullScreenPortraitView.Visibility == Visibility.Visible) { lstWordsPortraitView.ItemsSource = _model.Words; } else if (ScrollViewerWordsSnappedView.Visibility == Visibility.Visible) { lstWordsSnappedView.ItemsSource = _model.Words; } _model.ShowProgressBar(Visibility.Collapsed); } }
public ShowWordsWithTheSameLengthPageHandler(INavigationService navigator, WordsWithTheSameLengthViewModel model) { _navigator = navigator; _model = model; }