Saturday, April 14, 2012

WP7 Tutorial 1 - Getting Started

Getting started with developing for WP7 is actually pretty simple for a .NET developer or a new programmer.  The tools are free, the simulator is terrific, and there are more and more WP7 phones in the market now.  Microsoft has done a great job providing a development environment that is easy to use.  I want to go over the steps in getting going with WP7 development as well as what the basic project types are. 


As I said, the tools are free for starting with WP7 development.  You can get the tools from here... On the left hand side you will see the area for downloading the free tools
In the Windows Phone SDK 7.1.1 you will get the following:
  • Microsoft Visual Studio 2010 Express for Windows Phone
  • Windows Phone Emulator
  • Windows Phone SDK 7.1 Assemblies
  • Silverlight 4 SDK and DRT
  • Windows Phone SDK 7.1 Extensions for XNA Game Studio 4.0
  • Microsoft Expression Blend SDK for Windows Phone 7
  • Microsoft Expression Blend SDK for Windows Phone OS 7.1
  • WCF Data Services Client for Window Phone
  • Microsoft Advertising SDK for Windows Phone
For the SDK you will need a Vista or Win7 PC.  This means that you cannot install the phone sdk on an XP system. 
Supported operating systems: Windows 7, Windows Vista
  • Windows® Vista® (x86 and x64) with Service Pack 2 – all editions except Starter Edition
  • Windows 7 (x86 and x64) – all editions except Starter Edition
  • Installation requires 4 GB of free disk space on the system drive.
  • 3 GB RAM
  • Windows Phone Emulator requires a DirectX 10 or above capable graphics card with a WDDM 1.1 driver
Keep in mind that if you already have Visual Studio 2010 installed the SDK will tie to that SDK instead of Visual Studio 2010 Express.  A word of warning about this however - when I was helping Microsoft at a local university with a WP7 event, we had to make sure that SP1 was installed on all of the Visual Studio 2010 installs.  Doing this on 50 machines did take a while and I want to save everyone the time.  At the university they also had it setup to reset the machines back to a default VS2010 install on a reboot.  This means that the service pack and phone SDK needed to be installed over and over again. Finish installing the tools like you normally would to let you start making WP7 apps.


AppHub is the name of the site that you will use to submit apps and keep track of all of them.  This is the site.  When you sign up on AppHub you can make WP7 and XBox 360 games.  Joining AppHub is not free.  It is $99 per year, but Microsoft has deals every now and then to be able to get that fee back. You can make an unlimited number of paid apps and up to 100 free apps for WP7 and up to 10 games for the Xbox LIVE Indie Games.  Apps are certified by Microsoft to make sure that copywritten material is not included and that the apps are appropriate for the region of the world you are releasing them.  Another nice thing is that Microsoft will certify who you are.  As a developer, this can be a pain in the neck, but from the user point of view it means that you will never get an app that says that it is from Bank of America when it really is from a guy in New Jersey just trying to get your account info and passwords.  This actually happened on another phone store. As a paid member of AppHub, you can have up to three WP7 devices on your account and can developer unlock them.  Of course for some people, like students, a $99 fee is a little steep.  Microsoft has a program for students and educators called Dreamspark.  This program is similar to microsoft's BizSpark program, where the student can get all of the developer tools from Microsoft for free but it also allows the student to tie a single WP7 device to their developer account.  Microsoft is actually very generous to students and I know that I have handed out about 60 WP7 phones over two different university events.  If you are a student, see if there is a local event for you to get a phone, but you can at least sign up for Dreamspark and get all of the tools first.

No Phone -> No Excuses

Some people will say that they can't develop a WP7 app because they don't have a smart phone or they have a different brand of smart phone.  Well I want to say that this is not true.  The emulator that comes with the tools is extremely good.  For many types of applications, you can do most of your development and work with just the emulator.  For my first three apps in the store, I did not have a phone to use at all.  Obviously if you are making a huge game then you want to test it on a real device, but many apps don't need this.


Finally I am getting to the actual making of an app.  When you start up a new project in Visual Studio you get a dialog that looks like this. 
I highlighted the two different types of projects that are available for WP7.  The first is Silverlight for Windows Phone and the second is XNA Game Studio 4.0.  In this tutorial, I am only going to be going over the Silverlight projects.  I will have another tutorial later with XNA. Under Silverlight for Windows Phone, you will see a lot of different project types.  You might now see as many as I have shown here.  This does not mean that you are missing something.  If you look at the left hand side of this dialog you will see that it has a section for Online Templates.  This is a great feature of Visual Studio 2010.  You can get other project types from an online gallery of templates.  There are other things like online controls, and more that you can also download, but that is another tutorial.

Windows Phone Application

This application type is one of the simplest.  It is just a single window.  You can then add controls to the window like you would any other Silverlight app.  Some of my apps use this type because they are a simple interface for the user.

Windows Phone Databound Application

This application type is a very generic list of data. The data is typically a data bound list from some source, possibly online or entered from the user. 

Windows Phone Panorama Application

Panorama applications are a unique app type to WP7.  It has a large panorama image in the background that will scroll as you scroll the display left or right.  This way the user can have an easy way to move from screen to screen with a simple swipe.  My Thoughts and Prayers app uses this type of project.

Windows Phone Silverlight and XNA Application

This project type is new to the 7.1 Windows Phone SDK.  Before the Mango release last yet, you had to pick either a Silverlight project or an XNA project.  The issue with an XNA only project is that you have to make your own buttons, text, and sliders and all other controls.  This can be time consuming with a Button class just sitting there in the Silverlight that could be used.  This allows you to use the Silverlight controls with an XNA project running in the background.  This way menus, high score lists, etc can be written with standard Silverlight controls and that makes it easier for developers.

Video Demonstration

I am working on a video of this tutorial with samples of each of these project types.  I will put it up on YouTube on my channel and link to it here.  I will keep the videos short and sweet since I know that videos that are 30 minutes are both hard to sit thru and hard to edit.  ;-)

More to Come

In the coming weeks I am going to be adding many, many posts and demos on WP7 apps.  After I get all of the basic Silverlight posts out that I am wanting to get done, I will start on the XNA side of things as well.  Keep checking back for updates and for the video tutorials to help you to see each step of the way.  I know that some of these have helped me in the past.

No comments: