/// <summary> /// Handles Tapped event when a easy level is tapped on. /// </summary> /// <param name="sender">Button that was clicked</param> /// <param name="e">Event Arguments</param> private void onLevelClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Button button = sender as Button; if (button != null) { string tag = button.Tag as string; if (string.IsNullOrEmpty(tag) == false) { LevelWrapper levelWrapper = new LevelWrapper(); switch (tag.ToLower()) { case "easy": levelWrapper.LevelValue = Levels.Easy; break; case "medium": levelWrapper.LevelValue = Levels.Medium; break; case "difficult": levelWrapper.LevelValue = Levels.Difficult; break; } this.Frame.Navigate(typeof(TestYourSkills), levelWrapper); } } }
/// <summary> /// Invoked when a level is selected and generates appropriate questions. /// </summary> /// <param name="e"></param> protected override void OnNavigatedTo(NavigationEventArgs e) { LevelWrapper level = e.Parameter as LevelWrapper; if (level != null) { Levels levelValue = level.LevelValue; switch (levelValue) { case Levels.Easy: lowerLimit = 1; upperLimit = 10; optionMax = 100; break; case Levels.Medium: lowerLimit = 11; upperLimit = 30; optionMax = 500; break; case Levels.Difficult: lowerLimit = 31; upperLimit = 60; optionMax = 999; break; default: lowerLimit = 1; upperLimit = 99; optionMax = 999; break; } } // Generates Questions and Options in FlipView Items. this.GenerateTestCases(lowerLimit, upperLimit, optionMax, this.numberOfQuestions); //Set Data Context of FlipView. flipview.DataContext = testCases; base.OnNavigatedTo(e); }