During application development very often developers need to check how application works. Sometimes only running application on phone is needed, sometimes developer needs to check code line by line in Visual Studio in debug session. In very rare scenarios, some problems can occur, that makes testing difficulty.
I think that normal Windows Phone user gets used to that after connecting phone to computer by USB some features are being disabled. User cannot browse the Marketplace, take pictures, shoot movies, etc. The same restrictions apply to the software developer who wants to check how his application works.
Let’s think about camera – as a developer I would like to check how image is being processed after taking the photo. By checking this feature on emulator, developer will get photo of white square on black background. Theoretically he will be able to check how some part of code are working. But sometimes application on emulator works different than on real device and we cannot be 100% sure that our solution will work as we expected.
In that situation where the developer begins to test the application on the phone, he will discover that he cannot take the picture. The CameraCaptureTask will end with Cancel result. This situation is caused by Zune. The solution is easy, let’s close the Zune. Unfortunately we will lose possibility of debugging of our application.
Fortunate, Microsoft has foreseen such requirement and together with SDK for Windows Phone has provided small tool called WPConnect. This program is installed in C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\WPConnect\[x64|x86]\. Once you start it, your phone will connect to the computer and you will be able to used it as it was not connected. So you will be able to take photos, browse Marketplace, etc… and also you will be able to deploy and debug the application. All task will finish with success. And you will be able to take real photo.
In my case, the first think I am doing after connecting phone to the computer is closing the Zune and start WPConnect. This process can be optimized by script. I will write about this next time.
It may be surprising that Microsoft did not offer the option to choose what default program should be started after connecting Windows Phone to the computer.