From iLab Cookbook

Technologies: WindowsPhone


Windows Phone is one of the three big Smart Phone operating systems (the others are Android and the Apple IOS). If you already know how to program Windows using C# and WPF or Silverlight, you will find programming the phone pretty straightforward but highly interesting. As well as doing the usual graphical user interfaces, you can access sensor and multi-touch input.

NOTE

This page is under construction

Contents



Downloading software (if you want to develop on your own Windows machine):

  1. Install Visual Studio 2010 Professional through the MSDNAA program if you don't have it already.
  2. Download and install the Windows Phone SDK 7.1.
  3. Install the Windows Phone SDK 7.1.1 Update.
  4. Install the Zune software.
  5. Install the Windows Phone Toolkit


Creating Various Required Accounts

Unlike programming on windows, you need to establish several accounts that will ultimately let you register your phone for application development, and to download programs you develop on your phone.

  1. Sign up for a Windows Live ID account. You can use an existing account if you already signed up before.
  2. Register on DreamSpark. Fill out the form. Select the UofC in the field "Institution/School". Finally, click "continue to verify".
  3. On the next page, enter your UofC email address in order to verify your student status. Once you received the confirmation email, click the link in the email to confirm the student status.
  4. You now have to link your Windows Live ID to the DreamSpark account. Go to the DreamSpark Windows Phone page (direct link) and click the green button "Map your Live ID".
  5. On the page that opens up, enter your Windows Live ID account information. The dialog page that opens up, click "Cancel". On the webpage click "OK". Your DreamSpark and Windows Live ID accounts are now linked.
  6. Register an AppHub account. On the page that opens, click on "Join now - membership registration". Use your Windows Live ID (created during step 1) for this registration. Select "Student" as account type, fill out the rest of the form, and click "I accept"
  7. On the next page, fill out all your required personal information.

Registering your phone

You will not be able to download applications that you develop to your phone until it is registered. If you are using a Windows Phone that we gave you, we have already registered it so you can skip this step. If you are using your own phone, you must register it yourself.

  1. Follow all the steps above for downloading software and for creating various required accounts.
  2. Connect your Windows Phone via your USB cable and unlock it so that you can see the home screen.
  3. In the start menu, open the "Windows Phone SDK 7.1" and select the "Windows Phone Developer Registration Tool" (This would have been installed as part of the above downloads).
  4. Once in the registration tool, enter your Windows Live ID account and click "Register" to register the phone for development. Remember, the phone needs to be turned on and the home screen must be visible in order to unlock the device (otherwise you will get an error message).
  5. You can repeat step 1-3 to unlock up to 3 devices with your AppHub/WindowsLive account.

Note: You will only be able to install approximately 3 of your applications to your phone at a time. If you try to install more, you will get an error message. To remedy this, uninstall one of your applications by pressing and holding its application icon

Recipes and How-To's

CPSC 581 Tutorials

Tutorial 1 (Sept. 10th): GETTING STARTED

  1. Getting started with Visual Studio, C#, .NET, and Windows Phone programming
  2. Hello World application

Tutorial 2 (Sept. 12th): UI WIDGETS AND TOUCH

  1. Introduction to Silverlight, XAML, and Windows Phone programming (PDF, 1.1 MB)
  2. UI widgets, buttons, radio boxes, labels, using images, transparency loading resources
  3. Multi-touch events, graphics, manipulations and drawing on canvas:

Tutorial 3 (Sept. 17th): SENSORS

  1. Reading sensors: accelerometer:
  2. Using sensor readings to manipulate graphics:
  3. Use shake events in multi-touch drawing application:

Tutorial 4 (Sept. 19th): ANIMATIONS

  1. Animations in silverlight: animating position of object:
  2. Animating objects with different easing functions, e.g., bounce back:

Tutorial 5 (Sept. 26th): Manipulations

  1. Another way to manage multi-touch via the Manipulation. They:
    • combine the interaction of two fingers into a single action
    • are an easy way to combine the movement of one or two fingers into transforms for translation and scaling

Tutorial 6 (Oct 1): Sounds

  1. A way to rapidly play multiple sound effects. Note that this is mostly culled from several other examples, so I am not quite sure if what I did is the best way to do it.
    • uses the XNA framework, but not that complicated
    • note that you need to:
      • reference the XNA framework (and add the appropriate Using statements)
      • add the sound (and image) files to your solution as a Resource
      • for each sound, raise its context menu and mark its Build property as content
      • for each image, raise its context men and mark its Build property as resource
      • Download: PhoneAppSoundEffects source code, ZIP

Tutorial 7 (Oct 3): GPS and maps

  1. This tutorial demonstrates how to use the GPS sensor, visualize locations on a map, calculate distance between points, etc.

Other tutorials (for later):

  1. Data storage

Tutorial 7 : Changing background images to fill

  1. SilverlightTapToLoad" in Chapter 4: Bitmaps, Also Known as Textures from the Windows 7 Phone book. Julia found this useful for dynamically changing the background image fill.

Tutorials and Examples

Books

Links

Retrieved from http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/Technologies/WindowsPhone
Page last modified on October 22, 2012, at 09:57 AM