Friday 20 March 2015

Making a Quiz in VS 2013

What code is needed to make a quiz game application on windows universal application.
I am using Visual Studio 2013 to achieve this.

Step 1 :
Design the way you want the quiz to look.



Step 2:
This is the simple way of creating a quiz which if done by making a separate page for each page in the quiz.The only code that you need for this is:

-The code for the wrong answer.
-This code displays a message to let the user know that the answer they chose is not correct.
-First you need to insert:

using Windows.UI.Popups;

 private async void wrongAnswer_Click(object sender, RoutedEventArgs e)

        {
            MessageDialog dialog = new MessageDialog("Try Again!");
            await dialog.ShowAsync();
        } 


Step 3:
The code for the right answer is :

 private void rightAnswer_Click(object sender, RoutedEventArgs e)
        {
            this.Frame.Navigate(typeof(FunQ2)); // FunQ2 is another page 
                                                                         // the code from this button passed the quiz to the other                                                                               page.
        }