You just heard the complete end-to-end story for both the user and the developer at Mix10. I bet that by now you must be pretty excited about Windows Phone. The all new Windows Phone 7 Series holds a promise to be an amazing personal mobile phone with new innovative user interface and functionality, as well as a great development platform on which you can quickly and easily build games and applications. I hope you are ready to start coding your first Windows Phone (WP) application and get hands-on experience with the platform.
This chapter introduces the tools and the steps required to create your first Silverlight application for Windows Phone. You will learn how easy it is to get started by installing the tools and creating your first WP Silverlight application. While this chapter features a WP Silverlight application to introduce you to the WP development environment and tools, XNA game developers will also find this chapter useful as it covers the development tools used to create both WP Silverlight applications and XNA games. If you are completely new to Silverlight or XNA, you shouldn’t worry, as this chapter walks you through every detail of writing your first app. If you’d like to learn Silverlight, check out the Silverlight learning site at http://silverlight.net/learn/.
By the end of this chapter you will create a simple Twitter Search WP Silverlight application. The chapter walks you through the different steps of creating that application; by the end of this chapter you will:
- Learn everything you need to know about the development tools used to build, test and deploy your Silverlight (or XNA) applications, including Visual Studio 2010 Express for Windows Phone and the Windows Phone Emulator.
- Understand the structure of a Silverlight Windows Phone application and the differences between Silverlight (for web) and Silverlight for Windows Phone applications
- Refresh your memory with an a little overview of Silverlight programming model
While this is an introductory chapter about programming WP Silverlight applications, which some experienced Silverlight programmers might find a little “too basic”, we highly recommend that you, at least, take the time to read the chapter, even if only quickly. This chapter introduces the basics of developing and testing Windows Phone applications. This chapter also reviews some of the differences between Silverlight programing for web and for phone. You will read a lot more about Silverlight for WP in the second part of the book (“Building Windows Phone Applications using Silverlight”), but this chapter gives you a solid background of the Silverlight runtime capabilities for the Windows Phone platform.
Getting Started With the Tools
One of the success criteria for a popular consumer platform is having a large ecosystem of developers writing games and applications. Developers require tools and guidance to create compelling application. The process of obtaining the development tools and getting started should be, as much as possible, friction free, easy, and welcoming. Although it is safe for me to assume we are all developers, which implies that we know how to “handle” our development environments, I am sure that you, as I, really hate cumbersome installation processes of multiple frameworks and tools just to get a simple “Hello World” up and running.
Hence you will be happy to learn that in order to get started developing for WP, all you need is to download and install is a single installer application. The entire WP development environment can be installed on a clean Windows Vista or Windows 7 machine (at the time of this writing—Microsoft Mix 2010—the tools do not support XP) using the Windows Phone Developers Tools installer application. The best news is that the entire WP development environment is free! Yes, you read it right, everything you need to develop, test, and ultimately deploy your WP application is packed in to a single 300MB installer that is given free to anyone.
Among other thing, the installer installs the following on your Windows machine:
- Microsoft Visual Studio 2010 Express for Windows Phone , which is essentially a customized version of Visual Studio 2010 Express Edition. This is your Integrated Developer Environment (IDE) you will use to create WP applications and games. At the time of this writing, Visual Studio 2010 was not released yet, and was in its final Release Candidate stage.
- .NET Framework 4.0
- Silverlight runtime for Windows Phone
- XNA Framework and XNA Game Studio 4.0
- The Windows Phone Emulator, which will become your primary tool for debugging in case you don’t have a Windows Phone device.
- A bunch of other required goodies like Silverlight 4
Installing Microsoft Visual Studio 2010 Express for Windows Phone
It is time to start. The first step is to get your hands on the tools. If you already have the tools – mainly Microsoft Visual Studio 2010 supporting Windows Phone project, you can skip this section. But if you don’t have the tools, go to http://developer.windowsphone.com and download the tools—it is free, quick and friction free process. The Windows Phone Developer Tools installer makes sure your system is ready for developing for WP by installing all the items (and more) that we just listed.
The installation process will be different from one computer to the other, depending on which software you’ve already got installed. When installing on a clean Windows 7 machine, you can expect an installation time of somewhere between 20 to 30 minutes (time may vary based on your computer speed), The installer will show progress indication of about 15 steps (might be less if you already have some of the prerequisites installed) that it performs automatically, as shown in the following figure. During the installation process you may be asked to reboot your computer (after installing .NET Framework 4.0), the install process will continue after you login again.
When the installer completes its work, you’ll have all the tools you need to develop application for the Windows Phone including Visual Studio 2010 Express for Windows Phone and the Windows Phone Emulator.
The steps and screen captures in this chapter illustrate procedures using Microsoft Visual Studio 2010 Express for Windows Phone. However, if you already have a different version of Visual Studio 2010 installed on your machine, you may use it with the instructions in this chapter.