Summer Fun in the Mango Sun... Sample Data, Locations and Accelerometer

Today's post is a great summer project because it shows us how to use Expression, Mango and Windows Phone 7.x to quickly and easily build an app and so leaving us time for some fun in the sun... Smiley

Introduction to sample data and sensors with a cool summer application!

With the new Windows Phone many students have shown interest towards Microsoft’s tools and technologies. Through services like MSDN AA and DreamSpark students can easily try out the tools. These services offer students development tools and licenses free of charge. Adding a easy to learn technology like Silverlight to mix and you’ll definitely get started quickly, without having to sacrifice all of your free time.

This article was originally posted in the Finnish Tietokone-magazine that’s why the application will use Finnish festivals and names. I decided to translate the original article so English speaking students could read it as well and hopefully get an idea of what Windows Phone development is like. There is also a competition for Finnish developers over at Tietokone, that might get you a Windows Phone. All you need to do is see how fast your Expression Blend is!

This is not a detailed guide, if you’re looking for something more detailed I suggest checking out the Introduction to Windows Phone development-series.

...

Frist the sample data. Building an UI for an app is allot easier if you can see the app in action, see it with its data. But you can't see the app in action until you've written it, Chicken and egg thing.

Well Expression gives you a leg up and helps you create some sample data, which can ten be used by you, and Expression, to mimic your app running, at least as it comes to displaying data.

SNAGHTML57233fd7

SNAGHTML57261619

SNAGHTML5725bc36

Next, location, location, location...

SNAGHTML572b3f89

void ShowDirections(int itemIndex)
{
    BingMapsDirectionsTask bingDirections = new BingMapsDirectionsTask();
    GeoCoordinate helsinki = new GeoCoordinate(60.169812, 24.93824);

    FestariItem festari = festivalList.Items[itemIndex] as FestariItem;
    GeoCoordinate destination = new GeoCoordinate(festari.Leveysaste, festari.Pituusaste);

    //bingDirections.Start = new LabeledMapLocation("Helsinki", helsinki);
    bingDirections.End = new LabeledMapLocation(festari.Nimi, destination);

    bingDirections.Show();

}

And finally using the Accelerometer to shake things up...

The emulator allows you to test the accelerometers as well. Let’s make our application randomly choose a festival to go to if you shake it.

App Hub is a great place for different resources, from there you can download free tools, read different articles and download sample. Go to App Hub and download the ShakeGesture-library so you can easily detect shakes.

using ShakeGestures;

namespace Festarit2011
{
public partial class MainPage : PhoneApplicationPage
{
    public MainPage()
    {
        InitializeComponent();
        ShakeGesturesHelper.Instance.ShakeGesture += new EventHandler<ShakeGestureEventArgs>(Instance_ShakeGesture);
        ShakeGesturesHelper.Instance.MinimumRequiredMovesForShake = 4;
        ShakeGesturesHelper.Instance.Active = true;
    }

    void Instance_ShakeGesture(object sender, ShakeGestureEventArgs e)
    {
    }

void Instance_ShakeGesture(object sender, ShakeGestureEventArgs e)
{
    Dispatcher.BeginInvoke(delegate()
    {
        Random random = new Random();
        int randomIndex = random.Next(0, festivalList.Items.Count - 1);

        ShowDirections(randomIndex);
    });
}

Now we’ve gone through different parts of Windows Phone development. We’ve used Expression Blend and Visual Studio, done styles, used Sample data and tried out different events and sensors. You can download the finished application by clicking the image on the right. So what are you waiting for, take it one step further and create your own KILLER APPS!

That about says it all...

Here’s a few more links you might find interesting:

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.