Lets learn about creating Windows Phone Projects
Visual Studio 2010
- Visual Studio is an “Integrated Development Environment” for creating programs
- Edit program source
- Add and manage program resources
- Build, deploy and debug an application
- It can be used for multiple platforms and languages and can also be customized by plug-ins for the different target platforms
Windows Phone on Visual Studio
- Create the Windows Phone Solution
- Edit the program source files
- Add and manage program resources
- Build and run the solution
- Debug the solution on emulator or device
- Manage the properties of deployment in marketplace.
Visual Studio Project and Solutions
- A .NET Program is made up of assemblies
- An assembly is a library file(.dll) or an executable (.exe) and it contains compiled code and resources (e.g. images and sounds) along with a manifest.
- The .exe file also contains an entry point (Main)
- A Visual Studio solution project describes the content of a single assembly
- A Visual Studio solution is made up of number of projects and at least one of them has an entry point where a program can start
- A Visual Studio Solution is an XML file that contains reference to the project file that make up solution.
- Each project contains resources and code which contains single project can be shared amongst multiple solutions also a library assembly can be used in the library.
- New projects and solutions are created from templates installed in Visual Studio
- Additional templates can be installed so that the tool can be used to target different platforms
- These templates give you the basic structure of the type of program you are trying to make and also add the relevant references and saves you a lot of effort.
Making a Silverlight Application
- Silverlight apps are generally line of business apps which are used to do business with and there is a template that helps us create a Windows Phone Silverlight application.
- Very easy to create rich user interface.
- This creates the initial page for our application and configures Visual Studio to target the Windows Phone platform.
- If we want to create additional pages and add resources to the solution we can do this using Visual Studio.
Note – Windows Phone Mango is called 7.5 but the tools and the OS is called 7.1. The reason being the development team started pretty early and named the OS as 7.1 (after 7.0) but when the marketing team decided that they would call the whole package as 7.5
XNA Game Projects
- Could be developed in a similar way to a Silverlight app but the starting template needs to be different.
- The solution structure will be different though.
- The content project contains all the elements of the game, assets, texts,etc
- If you have not developed an XNA games before then i would like tell you that
- An XNA game will not be like a silverlight app in which you press a button but in an XNA game the stuff will be repeated 30 times a second.
- Its pain free and very well packaged.
- XNA is great for writing games
- Makes good use of graphics acceleration
- Can be tedious to create UI behaviors
Combining Silverlight & XNA
- It is possible for the silverlight form containing XNA content to hold silverlight components and this makes it possible to overlay Silverlight UI elements on top of an XNA display.
- This makes it easier to build interfaces to XNA game.
- Such a project will contain at least three projects
- SilverXNA – It is the project that actually does the running
- SilverXNALib – The libraries
- SilverXNALibContent – XNA library content which will have assets, etc
- When we make a silverlight and XNA combined program then we will have a page that will take us from the silverlight to XNA. So shown in the image below we will have a single button that will navigate to the game page on clicking.
- Also this button click starts the XNA game engine.
- The XNA page as shown below contains version of
Draw and Update methods that are called to run the game within the silverlight
Multiple Project Solutions
- A VS 2010 solution can have
- PC version of XNA game
- XBOX version of a game
- Windows Phone Version of a game
- They can also share code libraries which are also part of solution
- Many projects can share the output from a single project.
Running Applications on Windows Phone Platform
Windows Phone Device Basics
To connect from a Windows PC to Windows Phone Device we need the Zune software. this could also
- Synchronize Media
- Perform Phone Updates
- The download is available at http://zune.net
- Before we deploy our application on Windows Phone we need to register it as a developer device. This registration is a one time process and the registered developers can register up to 3 devices (but registered students can register only one device).
- Now you need to connect the phone to your PC and from the drop down as shown below we can select the Windows Phone 7 Device
- The debugging method and development environment is the same for both the WP devices and Emulator.
- The problems that you might face while deployment might be
- If the phone is displaying lock screen deployment will fail.
- Applications that use media will not work correctly if they are deployed when the Zune software is running. To solve this problem we can use “Windows Phone Desktop Pass- Through” program to connect instead of Zune. It is available with SDK.
- Once the application is deployed it will be stored on the device for later use but remember at a time you can have only 10 of your own applications on the phone at any time. You can anyways send the compiled version of your application to other registered developers for them to use on their developer devices.
- Emulator is available with Windows Phone SDK.
- It runs as a program on the windows PC.
- It has the same software as Windows Phone device but is targeted to run on Windows PC platform.
- The Emulator
- Has a browser
- Will provide phone behaviors for things like placing calls and sending SMS. Also it has some entries in phonebook
- Contains emulation of windows phone camera, GPS and motion sensors
- Has the ability to capture screenshots of programs running on the phone.
- If you are developing a game then it is recommended to run it on the phone as the performance is something which is not properly tested on emulator as it running in Windows environment.
- You can use a PC mouse to touch on the screen.
- If you have a multitouch monitor then that touch can be passed to the emulator as well.
- If you want to use the PC keyboard for typing then you should use the Pause/Break key to toggle the emulator keyboard. When the Emulator keyboard is not there it will take the input from PC keyboard.
- The windows Phone Emulator
- Does not support Zune media playback.
- Uses only only the built in browser application.
- Should be used for functional testing only.
- When you hover over the emulator with a PC mouse you will see an extra set of tools.
- These allow you to rotate the emulator into different orientations
- There are two landscape positions but only one portrait position.
- The camera can also be emulated but it can take a simple photograph and return it.
- Location Emulation also works now with Mango version. The location tab is shown below and you can click the location move the emulator to that position and also place pushpins to describe a route and then replay the route as well.
- Windows Phones contains an accelerometer and compass that can be emulated as well for determining the position.
- Also you can take screenshots in Windows Phone and the same can be emulated as well
- We can add breakpoints
- We can use Single Stepping
- We can use the Immediate Window
Your feedback and comments are welcome.