In this article we are going to see how to Simulate the Lock screen behavior while testing the application in Windows Phone Emulator. With this feature check we can test how our apps restores its state while activating and deactivating the Lock screen when the application is in working stage. The application instead of going to terminated state it should go to dormant stage unless we have enabled tombstoning on debugging the application. While the phone is unlocked the app will basically be activated and restores the state of the application. [more]
Let us see how we can use this feature in Windows Phone Emulator while locking and unlocking the application. Open Visual Studio 2012 IDE in administrator mode and open an existing application which we developed in our previous articles as shown in the screen below.
Now let us see how we can simulate the lock screen scenarios in Windows Phone Emulator, first run the application in emulator or the device without debugging mode as shown in the screen below.
In Visual Studio 2012 IDE, under tools menu we have an option Simulation Dashboard which will be the primary tool to test the scenarios. Click on the Simulation Dashboard will show a popup window as shown in the screen below.
In the simulation dashboard we can see the option Lock Screen with 2 radio buttons Locked and Unlocked. So we can change between these 2 options to test the application in the Lock Scenario and in the Unlock scenario. From the coding perspective when the phone is locked first the Obscured event happens and followed by the Deactivate event will be raised and when the phone is unlocked first the Activated event will be raised and then the UnObscured event will be raised.