Building a Windows Phone 7 Look-a-like

by CameronM 13. September 2011 07:26

After viewing some of the fan-mail for Sahas Katta's WP7 resume, I decided to check out just how hard it would be to build a WP7/Metro inspired website. While both Sahas' and my own attempts are not exactly perfect mirrors of the Windows Phone 7 end-user experience, it was certainly an interesting experiment.

Has your boss already bought you an Android? Are you stuck with an iPhone? Do you really wish you could experience a Windows Phone without parting with your hard-earned cash?

Well here is your solution. Take a look at this Windows Phone 7 (Mango-release) inspired site .

The site is constructed using some screenshots from the WP7 emulator and the layout is true to the actual device - trust me, I have spent enough time developing for WP7 that I know these proportions off-by-heart.

 

WP7 Inspired Site

Tags: , ,

ASP.NET | C# | WP7

WP7 Mango Features #4: ShareStatusTask

by CameronM 10. September 2011 06:55

Ok, so it has only been a few weeks since I signed up for my first twitter account, and yes that was only after some very serious persuasion by Emily, the Spotlight2011 Program Manager, but I couldn’t help but have a play with the new Windows Phone Mango release Social Tasks.

The ShareStatusTask does nothing when running under the emulator, this is because is relies on the social networks you have linked to your phone’s Live account. Obviously, the emulator does not have a Live account associated with it, so you really need to test this out on a real phone.

private void Button_Click(object sender, RoutedEventArgs e)

{

    //the sharestatustask will not work in the emulator as it needs your social network account details

    ShareStatusTask shareStatusTask = new ShareStatusTask();

    shareStatusTask.Status = "Testing some great features for our mango release";

    shareStatusTask.Show();

}

I did, and I can report that after clicking the button on the app, a screen containing both the message and a list of social networks to post to was displayed. The user can easily select one or more of the social networks, such as Live, Twitter and Facebook. By default, all networks are selected, so you simply need to unselect the accounts you don’t want to post to. The user can also change the text being sent, or even cancel posting the status update. As with the EmailComposeTask in NoDo we see Microsoft continuing the policy that the user must always have the ability to cancel or amend the message before it is sent, making sure that any app you install won’t start randomly messaging everyone you know. 

Anyway, here are the results from posting an update to Twitter using the TrafficmateWP account.

Tags: , , , ,

WP7

WP7 Mango Features #3: Bing Search

by CameronM 8. September 2011 16:14

While on the subject of all things Bing and following on from recent posts on the new Bing Maps Tasks available to developers in the Windows Phone Mango release, I noticed another feature, called the SearchTask, is still alive and well from WP 7.0.

Although I hadn't needed to use the SearchTask previously, after a brief experiment I realised that this is another easy way to access some of the great Bing features on Windows Phone. The SearchTask, as the name suggests, launches the newly revised Bing Search app – you know the app that always stars when you accidently hit the ‘search’ button on your phone! This time however, as a developer you can actually launch this app and set the search string so that the user is taken straight to the relevant results.

private void Button_Click(object sender, RoutedEventArgs e)
{
    SearchTask search = new SearchTask();
 
    search.SearchQuery = "Brisbane restaurants";
    search.Show();
}

Tags: , ,

WP7

WP7 Mango Features #2: BingMapsDirectionTask

by CameronM 1. September 2011 06:02

In the previous post I covered the new Bing Maps Tasks available to developers in the Mango release for Windows Phone. In that post I showed you how to use the search task to located business or point of interest matching your search term. In this post we will cover the other new feature, the BingMapsDirectionTask. Again this is a huge time-saver for anyone who has ever tried to use the Bing Maps API and built a ‘get directions’ page from scratch. 

Follow the instructions in the previous post to get started. Once you have all the references sorted, create a new button and code its OnClick event to the following. 

The BingMapsDirectionsTask requires either the start or end location to be explicitly set, and it will use the device location for the one you do not specify. Of course in the emulator, you will want to set both values.

As with the BingMapsTask, you only require a few lines of code to gain access to all the goodness of the built-in Bing Maps application.

private void Button_Click(object sender, RoutedEventArgs e)

{

    BingMapsDirectionsTask directions = new BingMapsDirectionsTask();

    //your must specify either the start or end locations

    //if you leave one of these empty, Bing will use the current location

    //if using the emulator simply specify both start and end

    directions.Start = new LabeledMapLocation("Home", new GeoCoordinate(-27.31063, 152.99032));

    directions.End = new LabeledMapLocation("Work", new GeoCoordinate(-27.46868, 153.02105));

    directions.Show();

 

}

 

One interesting thing I noticed after accidently swapping a few numbers in the Start lat/long was that I ended up on Stradbroke Island. Not deterred by my error, Bing actually directed me to the ferry terminal and even included a helpful message ‘check the timetable’.

Tags: , ,

WP7

WP7 Mango Features #1: BingMapsTask

by CameronM 31. August 2011 04:40

Now that the Tech-Ed finals for Spotlight2011 are over, I have had the chance to install the Mango pre-release image on my Windows Phone. I had only seen a few of the great new features in videos and a session at Tech-Ed, so it was good to actually get my hands on the real OS. Along with some very cool features from the users perspective, Mango has a host of new and improved features for developers. One that immediately jumped out was the new BingMapsTasks. 

If you have ever had to create a WP7 app that uses the Bing Maps API you’ll appreciate that it is not an easy task.  In fact, as great as the Windows Phone 7 Developer Labs were, I always struggled with the Bing Maps labs. This was partly due to the fact that the labs chose to use a MVVM pattern, which was completely foreign to me at the time and added a level of complexity that made learning how to use the API overly difficult.

You will be happy to know that the WP7 Mango release has come to your rescue with some new ‘launchers’ specifically designed to leverage the Bing Maps application built into the OS. Similar to the email and camera launchers currently available to Windows Phone developers the BingMapsDirectionsTask and BingMapsTask can be used to directly launch the Bing Maps application.

Start a new project and be sure to target the 7.1 Windows Phone OS.

The BingMapsTask is contained in the Microsoft.Phone.Tasks namespace, so you will need to add a using statement to your MainPage.xaml.cs file.

The first task we will look at is the Bing Search, which can be used to find businesses and landmarks located near a particular geographical point. By default, the current location of the device is used for the center of the search however you can specify any geographical location.

If you are using the emulator then you will want to declare a defined center for your search. To do this, add a reference to the System.Device library by right mouse clicking on the References folder in you project and selecting Add Reference. Once you have added the System.Device library you can add the following using statement to your MainPage.xaml.cs file;

Now you can define the Center for your search be creating a new GeoCoordinate object and setting its Latitude and Longitude to suitable values.

 

private void Button_Click(object sender, RoutedEventArgs e)
{
    BingMapsTask bmt = new BingMapsTask();
    bmt.Center = new GeoCoordinate(-27.5, 153);
    bmt.SearchTerm = ("coffee");
    bmt.Show();
}

 

The code results in the Bing Maps app opening, centered at the specified location and showing all matching locations, in this case places related to coffee. The user can then use all the built-in Bing goodness, to browse around the matching businesses and get directions from their current location. All you had to do was write a few lines of code - very nice.

Tags: , ,

WP7

WP7 Mango Features #5: ShareLinkTask

by CameronM 15. August 2011 07:30

 

In my last post I looked at how easy it was to add the ability to update your status on social networks such as Windows Live, Twitter and Facebook. An obvious extension of a simple status update is the ability to add a web link. This scenario is supported by most major social networks and it only seems fitting that Windows Phone Mango now offers developers an easy way to achieve the same results.

private void Button_Click(object sender, RoutedEventArgs e)

{

    ShareLinkTask link = new ShareLinkTask();

    link.Title = "TrafficMATE";

    link.LinkUri = new Uri("http://blog.ezidata.com.au/post/Connect-your-app-to-the-Social-Network.aspx");

    link.Message = "Traffic Incidents via twitter in Windows Phone Mango #wp7";

    link.Show();

}

 

As with the previous post, the ShareLinkTask only works on a real device, as it relies on the social networks you have linked to the Live account on your Windows Phone. When run on the device, users are again prompted to select which social networks to post the link to and can select from whatever account that currently have linked.

 

 

Tags: , , , ,

WP7