Windows Phone Tutorial 7 : Verification

As a part of our Windows Phone tutorial series, today you will learn to build, deploy, and run the application in the Windows Phone Emulator to test that it works as expected. In addition, you set a breakpoint, use the debugger to step through the source code, and examine the value of variables for a brief glimpse at how you can use Visual Studio to debug applications running in the emulator.

  • Open the code for MainPage.xaml. To do this, right-click this file in Solution Explorer and then select View Code.
  • Set a a breakpoint to stop execution at the event handler for the “Click Me” button. To set the breakpoint, locate the first line of the ClickMeButton_Click method in the source file and then click the area in the gray margin located on the left side of the editor window, next to this line. A red circle indicates the position of the inserted breakpoint. Alternatively, you can also click the line in the editor window to select it and then press F9
  • Press F5 to build and deploy the application to the Windows Phone Emulator and start the debugging session.
  • In the emulator window, enter some text into the text box and then click the button next to it. You will automatically go back to Visual Studio, notice that execution stops at the breakpoint that you set previously and that the next statement to execute appears highlighted in yellow.

  • Examine the current contents of the text box in the debugger. To do this, in the source window, place the mouse cursor over the textBox1.Text property. A tooltip window—commonly known as a datatip—pops up to display the current value of the property, which should match the text you entered in the emulator window. Make sure that the cursor is over theText part; otherwise, the datatip displays information about the textbox1 object instead.

  • Press F10 to single-step over the current statement and set the text of the banner to the contents of the text box. Display the datatip for the textBlockListTitle.Text property to confirm that its value now matches that of the text box.
  • Press F10 once again to execute the next statement and clear the contents of the text box. Once again, display the datatip for the textBox1.Text property, which is still in scope, and confirm that it is now empty.
  • Finally, press F5 to resume execution of the application. Switch back to the Windows Phone Emulator

Click the Back button in the emulator to navigate to the previous page. Notice that when you do this, the debugging session ends and the emulator displays its start menu because you are navigating away from the first (and only) page of the application and there are no previous applications currently active.

Posted by on , in Category Phone with Tags
This post has been submitted by a Guest Author. If you would like to submit a guest post, you may contact me on the mail ID mentioned in the About page.

Leave a Reply

Your email address will not be published. Required fields are marked *

8 + 9 =