Beispiel #1
0
 /// <summary>
 /// It populates the next question into the current view.
 /// </summary>
 /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
 /// <param name="e">RoutedEventArgs e is a parameter called e that contains the event data, see the RoutedEventArgs MSDN page for more information.</param>
 private void Next_Click(object sender, RoutedEventArgs e)
 {
     if (puzzle.getActiveCount() == puzzle.getSpellingsList().Count - 1)
     {
         Frame.Navigate(typeof(ScorePage));
     }
     puzzle.setActiveCount(puzzle.getActiveCount() + 1);
     PuzzleNumber.Text = "Word #" + (puzzle.getActiveCount() + 1) + " out of " + puzzle.getSpellingsList().Count;
     Next.IsEnabled    = false; Spell.IsEnabled = false;
 }
 /// <summary>
 /// The methods provided in this section are simply used to allow
 /// NavigationHelper to respond to the page's navigation methods.
 /// <para>
 /// Page specific logic should be placed in event handlers for the
 /// <see cref="NavigationHelper.LoadState"/>
 /// and <see cref="NavigationHelper.SaveState"/>.
 /// The navigation parameter is available in the LoadState method
 /// in addition to page state preserved during an earlier session.
 /// </para>
 /// </summary>
 /// <param name="e">Provides data for navigation methods and event
 /// handlers that cannot cancel the navigation request.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     puzzle            = Models.SpellingsModel.getInstance();
     PuzzleNumber.Text = "Word #" + (puzzle.getActiveCount() + 1) + " out of " + puzzle.getSpellingsList().Count;
     if ((puzzle.getActiveCount() + 1) == puzzle.getSpellingsList().Count)
     {
         Next.Content = "Submit";
     }
     pageTitle.Text       = puzzle.getPuzzleName();
     OriginalWord.Text    = "Word: " + puzzle.getSpellingsList().ElementAt(puzzle.getActiveCount()).getWord();
     WordDescription.Text = "Meaning: " + puzzle.getSpellingsList().ElementAt(puzzle.getActiveCount()).getDescription();
     this.navigationHelper.OnNavigatedTo(e);
 }
Beispiel #3
0
 /// <summary>
 /// The methods provided in this section are simply used to allow
 /// NavigationHelper to respond to the page's navigation methods.
 /// <para>
 /// Page specific logic should be placed in event handlers for the
 /// <see cref="NavigationHelper.LoadState"/>
 /// and <see cref="NavigationHelper.SaveState"/>.
 /// The navigation parameter is available in the LoadState method
 /// in addition to page state preserved during an earlier session.
 /// </para>
 /// </summary>
 /// <param name="e">Provides data for navigation methods and event
 /// handlers that cannot cancel the navigation request.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     Frame.BackStack.RemoveAt(Frame.BackStackDepth - 1);
     puzzle            = Models.SpellingsModel.getInstance();
     PuzzleNumber.Text = "Word #" + (puzzle.getActiveCount() + 1) + " out of " + puzzle.getSpellingsList().Count;
     pageTitle.Text    = puzzle.getPuzzleName();
     if (puzzle.getActiveCount() == puzzle.getSpellingsList().Count - 1)
     {
         Next.Content = "Submit";
     }
     Next.IsEnabled  = false;
     Spell.IsEnabled = false;
     this.navigationHelper.OnNavigatedTo(e);
 }
        /// <summary>
        /// Executed when the Enter button is tapped/pressed. It checks the correct word with the spelling entered by the user.
        /// </summary>
        /// <param name="sender">Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.</param>
        /// <param name="e">RoutedEventArgs e is a parameter called e that contains the event data, see the RoutedEventArgs MSDN page for more information.</param>
        private void Enter_Click(object sender, RoutedEventArgs e)
        {
            Enter.IsEnabled   = false;
            Back.IsEnabled    = false;
            Answer.Visibility = Visibility.Visible;
            string yourWord     = Word.Text;
            string originalWord = puzzle.getSpellingsList().ElementAt(puzzle.getActiveCount()).getWord();

            if (string.Equals(yourWord, originalWord, StringComparison.OrdinalIgnoreCase))
            {
                puzzle.setTotalCorrect(puzzle.getTotalCorrect() + 1);
                Response.Text = "You got the right word !";
            }
            else
            {
                puzzle.setTotalWrong(puzzle.getTotalWrong() + 1);
                Response.Text = "Sorry, the word you entered is wrong!";
            }
        }
 /// <summary>
 /// The methods provided in this section are simply used to allow
 /// NavigationHelper to respond to the page's navigation methods.
 /// <para>
 /// Page specific logic should be placed in event handlers for the  
 /// <see cref="NavigationHelper.LoadState"/>
 /// and <see cref="NavigationHelper.SaveState"/>.
 /// The navigation parameter is available in the LoadState method 
 /// in addition to page state preserved during an earlier session.
 /// </para>
 /// </summary>
 /// <param name="e">Provides data for navigation methods and event
 /// handlers that cannot cancel the navigation request.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     puzzle = Models.SpellingsModel.getInstance();
     PuzzleNumber.Text = "Word #" + (puzzle.getActiveCount()+1) + " out of " + puzzle.getSpellingsList().Count;
     if ((puzzle.getActiveCount() + 1) == puzzle.getSpellingsList().Count) Next.Content = "Submit";
     pageTitle.Text = puzzle.getPuzzleName();
     OriginalWord.Text = "Word: "+ puzzle.getSpellingsList().ElementAt(puzzle.getActiveCount()).getWord();
     WordDescription.Text = "Meaning: "+ puzzle.getSpellingsList().ElementAt(puzzle.getActiveCount()).getDescription();
     this.navigationHelper.OnNavigatedTo(e);
 }
 /// <summary>
 /// The methods provided in this section are simply used to allow
 /// NavigationHelper to respond to the page's navigation methods.
 /// <para>
 /// Page specific logic should be placed in event handlers for the  
 /// <see cref="NavigationHelper.LoadState"/>
 /// and <see cref="NavigationHelper.SaveState"/>.
 /// The navigation parameter is available in the LoadState method 
 /// in addition to page state preserved during an earlier session.
 /// </para>
 /// </summary>
 /// <param name="e">Provides data for navigation methods and event
 /// handlers that cannot cancel the navigation request.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     Frame.BackStack.RemoveAt(Frame.BackStackDepth - 1);
     puzzle = Models.SpellingsModel.getInstance();
     PuzzleNumber.Text = "Word #" + (puzzle.getActiveCount()+1) + " out of " + puzzle.getSpellingsList().Count;
     pageTitle.Text = puzzle.getPuzzleName();
     if (puzzle.getActiveCount() == puzzle.getSpellingsList().Count - 1) Next.Content = "Submit";
     Next.IsEnabled = false;
     Spell.IsEnabled = false;
     this.navigationHelper.OnNavigatedTo(e);
 }