Susan IbachTechnical Evangelist
Part 4 in Susan’s series on building a Windows phone app from absolute scratch, in this post I figure out the differences between project types including pivot and panorama.
Did you miss part of the series? Check here!
Okay, I’ve installed the tools, I’ve done a Hello World application.l I want to start building my app now! So Go to Visual Studio 2010 | File | New Project and I see this…
There are 9 different project types just for Silverlight! (Quick aside: the XNA Game Studio 4.0 Phone projects are generally for games, and I am not going to try a game for my first app, but if you have played with XNA and are interested go for it and let me know how it goes, I’ve seen lots of cool windows phone games built by students!)
So which one should I use? Well I suppose I need to figure out the differences so here goes, I’ll dig through all the documentation and hopefully save you some time and effort doing the same.
This creates a one page application. I checked and yes, you can add additional pages. You can’t get any simpler than this as a project type. So if your application is just going to be one or more screens and you will have the user navigate between them, this will work. Users will click on buttons or links to move between pages.
This creates a one page application, that has a listbox on the page and it implements the Model-View-ViewModel design pattern! Well that clears that up! Okay what the heck does that mean for me…apparently its a way to separate your data from your user interface. So basically you write a class that says what data you want to show in the application (that’s the Model part), then you design a control that will show the data (that’s the View part), then you write code that says which bits of data display in which parts of your control (that’s the ViewModel part). Users will click on buttons or links to move between pages.
So I would choose this type of project if I was designing an app that was going to get data from some sort of source and was going to be displaying this data to the user. I think the Where’s Timmy app that finds you the nearest Tim Hortons is an example of a Windows Phone Databound application.
If you are planning to build multiple phone applications, and you write a clever piece of code that you want to be able to re-use in more than one phone app, put it into a Windows Phone Class library.
If you aren’t sure, you can always do this later. I have two apps I want to build this year, both of them will have a timer that counts down, so there is a probably a way I can make the logic that counts down the timer re-usable. But for my first app, I’m not going to worry too much about re-usability, I just want to get it working, I’ll probably go back and rework it a bit to make the code re-usable when I build my second app. But if you are one of those programmers who likes to make everything re-usable right from the get go, you could add a Windows Phone Class Library to your application right away to hold the code you want to use in other apps.
Gives you a project with a panorama control. Well that doesn’t help if I don’t know what a Panorama control is! Luckily I have a co-worker who wrote a blog post on the difference between panorama and pivot and here’s what I learned from that post.
Forgetting the phone for a second, a panorama picture is one of those long horizontal pictures like this
On phones sometimes you scroll up and down, sometimes you scroll from left to right. Apparently they did research and figured out that it is more natural for our hands to scroll side to side instead of up and down (who knew!) Panorama applications are designed for sideways scrolling. When you do a panorama application you can make multiple pages appear on a single background. Users scroll side to side to see the different pages but the pages feel more integrated as you scroll across the content because you have a continuous background. It’s a really cool look and feel. You move from one page to the next as you scroll. It’s great for unstructured content, where you just want someone to explore by scrolling across to see what’s in the application. The red rectangle below gives you a sense of what the user sees on the screen. They can see just a fraction of the header and content for the second page so they can see that something is there and it encourages them to scroll and explore.
The IMDb app is an example of a Panorama app.
According to MSDN a pivot application is a phone that uses a Pivot Control (and if you look up redundant in the dictionary it says see redundant). So back to Paul’s blog on Pivot vs Panorama.
Pivot applications scroll left to right just like panorama applications, but Pivot applications are usually more structured and data driven. If you think your user will expect specific menu items to choose from in the application, go with pivot. For example, when I open a twitter application, as a user I want to be able to choose between viewing my twitter feed, my Direct messages, and tweets that mention my twitter handle. Each of those will display a different list of data on my screen.
Another difference between a pivot and panorama control is that you can see the title of the next page. The user can scroll to move pages or tap the menu item to move to the that page. For example, if I built an app for the winter Olympics, when they are looking at Today’s events they can see from the title bar that scrolling will take them to the medals, or they can tap the word medals to move to that page.
You can’t see any content from the medals until you move to that page.
The Globe and Mail is a pivot application, so is the email application built into the phone.
These rules are not absolute! There is no rule that says you can’t show structured data in a panorama app. Check out the Facebook app, they went with Panorama, Twitter went with Pivot. I recommend checking out different panorama and pivot apps and seeing which you think best suits your app.
This creates a project that allows you to use Silverlight and XNA in the same application. This is something that lots of people wanted and was added in 7.5/Mango. You can also go the XNA Game Studio 4.0 project types and pick the same template. You get the same template either way. This template will give you an application with two pages: one Silverlight, and one Silverlight that shows XNA content. You also get a button to go from the Silverlight to the XNA.
Gamers like to use this project type because they use XNA for their games, but Silverlight is great for things like listing high scores, or letting users choose between levels.
Don’t dismiss it for non gaming applications! if you want to add cool 3D graphics to your application you’ll need XNA for that. Check out the application built by British Airways, it’s a great example of how using XNA can add some Wow to a Silverlight application.
Want to play music in the background? Do you want the option of having the music keep playing if someone leaves the application?
Adding this project to your application will give your application access to the classes you need to play audio files in the background.
This is the same as the Windows Phone Audio Playback agent except you use it for streaming audio files.
Adding this project to your application will give your application access to the classes you need to play streamed audio files in the background.
Do you want to have a scheduled task running in the background? Do you want to periodically check if there are new blog entries? DO you want to refresh data on the phone when the user has a network connection instead of over the data plan?
Adding a windows phone scheduled task agent gives you access to the classes that allow you to schedule tasks to run in the background at a particular time or under particular conditions (such as when the user has a network connection).
Wow, did that blog ever take me a long time to write! But I feel a lot better about my understanding of the project types now and hopefully I saved you some time with the summary. There are really 4 base project types: Phone Application, Phone Databound Application, Panorama, and Pivot. My first app is going to be a timer so I’m starting with a Phone application next blog I can start coding my app!
Join me on my quest to publish an app, and remember you could get cool stuff if you publish an app in Canada by May 20th, 2012.
I can write code, but I always run into issues installing, testing, deploying, and dealing with nit-picky stuff. Everyone told me if you can code you can build a phone app, so I decided to put that to the test in this blog series.
I will update this blog post as I continue my adventures so you can follow the series, please join me on my adventure as I code and publish my first app!
Part 1 – Installing the tools
Part 2 – Writing Hello World
Part 3 – Tombstoning
Part 4 - Project Types (including Pivot vs Panorama)
Part 5 - Windows Phone Controls
Part 6 - Displaying Numeric Keypad and testing for numeric values
Part 7 - Free controls from the Windows Phone Toolkit
Exams are done, end of term projects are submitted, and hopefully everyone made it to their destinations despite any freezing rain or snowstorms. Hope you have a great holiday and find time to catch up with a few friends and eat a few goodies. Best wishes for a happy and safe holiday season and a great start to the New Year from the GoDevMental team!
If you are using HTML5, you might want to check out Modernizr, I wrote a blog for the Make Web Not War site about how Modernizr so can help you start using HTML5 features but still support older browsers.
And if you are doing HTML5 check out our truly awesome HTML5 Canadian coat of arms…I think we need a name for that angry beaver, feel free to suggest one! As our holiday present to you, you can even download the image if you want it (PNG or SVG)!
Publish 1 quality phone app get a Kinect, or 1 TB hard drive, 2 apps could get you a $500 gift voucher or Xbox with Kinect!!!
Okay exams just ended, if you weren’t sure what to do during Christmas break, you need to check out this awesome promotion! It boils down to this: if you publish a quality app before May 20th, 2012 you can get cool stuff (go to the rewards tab to see your choices). If you publish 2 quality apps you can get even more cool stuff, and it just gets better!
If you think you can’t build a phone app, guess again, if you can code, you can build an app. Check out some great resources. Or join me on my phone app building journey blog series as I prepare to publish my first app.
Make efficient use of your time. Develop your app as an entry for imagine cup and/or do it as a project in a programming course.
What are you waiting for, stop reading, and get coding!