EziData Solutions

Web, NET and SQL Server

Windows Phone App Studio

At a recent Microsoft event one of the presenters reminded the audience of the Windows Phone App Studio and mentioned a bunch of new features, including support for Windows 8.1 and Windows Phone 8.1 Universal Apps. 

I signed up for an account when App Studio was still in limited beta and was immediately impressed by the ease at which you could develop a simple content based app. I remember mentioning it to a couple of guys in the office and saying that if this sort of thing kept up, we'd all be out of jobs. 

Having not done a lot with App Studio since, I decided to fire it up again and see just how easy it was to create an app based on some publically available content and publish it to the store. 

I've got a friend who enjoys going on cruises, almost to the point of it being an obsession and as we'd all just booked cruises for later in the year, I decided I'd build an app for cruisers called CruiseJunkie. 

Step 1: Sign up for an account using your Microsoft account. 

Step 2: Start a new project and select the template type (I chose an Empty App) 

Step 3: Add some 'sections' to your app.  

Sections render as PanoramaItems on the main page of the app. There's a few common sections available, including Facebook, Instagram, and Flickr. You can also add your own collections, which could contain static data (stored in the app) or dynamic data (store in Azure). 

Step 4: Choose a style for your sections.  

You can choose from a large range of styles for each section so that no matter what sort of data you're pointing at, there's bound to be one that looks just right. 

Most sections consist of two pages, one showing a list of data and the other showing a single item. You can choose layouts for both of these pages.  

Step 5: Choose a theme for your app 

You can choose from a Light or Dark theme, or go ahead and create your own by setting Background images and choosing appropriate colours. 

Step 6: Upload your Tiles 

Getting artwork for you app, including the tiles, is probably the most time-consuming task in the whole process. I grabbed a suitable icon from the Noun Project for CruiseJunkie, so it didn't take too long. The App Studio page displays the sizes you need depending on the tile option you choose. For the Flip tile template, you'll need 160x160, 340x340 and 715X340 jpg images. 

Step 7: Download the source code, or publish you app 

Once you've completed the steps above, you're ready to start thinking about what to do next. You can download the source code and make additional changes using Visual Studio, or go ahead and publish the app. 

Since I wanted to test the end-to-end process I decided to publish the app. This process wasn't quite as easy as I had though it should be. App Studio includes a reasonably detailed set of instructions to follow here as well as a video

After you associate your Store app with your App Studio project you'll still need to download the complete package (XAP file and screenshots) and upload it into the correct places in the Store. I'd like to see this a little more integrated, since you've already provided most of the information needed by the Store in your project. Having said that, it is still really easy.

Previewing your app

One of the best features of App Studio is the live preview that lets you see exactly what your app looks like. The Preview is displayed on every step of the process, so you're never left wondering how the changes you are making will look in your app

Posted: Jun 24 2014, 00:00 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Resizing the HubTile Control

One common task is to make the HubTile larger, to provide better proportions on a single page. The original HubTile is modelled after the live tiles on the Windows Phone 7 start screen, so it was set at a size of 173x173. This works fine on the start screen, but on a single page inside your app it will feel a little awkward with the blank space on the right hand side.

In Blend, right click on the AvatarListView in the Objects and Timeline panel. Edit Additional Template - Edit Generated Items (ItemTemplate) - Edit a Copy. Give your template a name (AvatarItemTemplate) and accept the default to define it in the current document.

Next, right click on the HubTile element in the Objects and Timeline panel and choose Edit Template - Edit a copy and name it AvatarHubTileStyle.

This will create a new control template based on the original HubTile. Your AvatarHubTileStyle will contain a number of elements as shown in the picture below.

If you click on the TitlePanel element, you see that the magic of the HubTile is really just made up of three different elements a Border, BackPanel (a Grid) and an Image (inside a Border). Animations are used to move and flip these elements to give them the "Live Tile" feel.

Now that you have your own version of the HubTile to play with, you are only limited by your imagination as to how you want it to be rendered.


Posted: Jun 27 2012, 20:02 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Windows Phone 7 | WP7

Skype Beta on Windows Phone 7

Like many people, I was glad to hear in February that there was finally a WP7 app for Skype (beta version). Although I don't personally have much need to use Skype, I appreciate just how powerful it can be for both cheap international calls and video calling.

I downloaded the Skype Beta from the link provided on their blog and gave it a run on my HTC Mozart. It looked ok, I could certainly see the few contacts I had on Skype, but I didn't really give it a second thought. That was until I was in Thailand recently and again thought how great cheap (free) video calling would be for communicating with friends and family while on vacation (or living as an expat). My 4-year old son is pretty good on the phone, but I knew that if he could see daddy while talking, the conversation would be far more free-flowing.

First-things-first, most of you will know that there are no Windows Phones out there with front facing cameras, so it's a bit of guesswork figuring out if your face is actually in the frame when placing a video call. I managed to get it working ok, but eventually I just connected my laptop to the phone's Wi-Fi and used a regular webcam, which made it a whole lot easier. Perhaps the fatal flaw with the current Beta version is that it does not work in the background, so even if you have opened the app and signed in as soon as you go back to the start screen or open another app, it is game over.

Once I got home I was testing the app a little further and I was even more horrified. I started the Skype app on my Nokia Lumia 800 and logged in, making sure it had time to get all the latest info before pressing the Windows key to go back to the start screen. I then Skype called myself from my old HTC Mozart. As expected the Lumia 800 did nothing, even the Skype page on the Windows Phone Marketplace makes it clear that the app doesn't run in the background. What annoyed me the most was that my iPad2, which was being used by my wife to watch some movie trailers on YouTube, got the call!

Where is the sense in all this? Why does Skype, a company bought by Microsoft in 2011 for a bucket of cash (US$8.5 Billion), take so long to deliver what is effectively a test app for Windows Phone? I mean, how serious is their commitment to Windows Phone? Do they expect you to have the app open waiting for a call? Maybe the execs at MS and Skype thought it quite reasonable to expect users to call, text or tweet each other to let them know to open the app. Maybe a text along the lines of "Hi honey, about to Skype you to remember to buy milk, can you please start the Skype app".

By the way, I love my Windows Phone and would dearly love to see the whole ecosystem evolve. It offers so much already built-in (baked-in) in terms of email, calendar and social networking that there's not a lot more I could want. One of my favourite things (and certainly my best argument when chatting at work with the iPhone/Android mob) is that I have downloaded hardly any apps because the OS provides so much already. Skype is currently not part of that great experience and it needs to be – really, really soon – if Windows Phone is to have a chance. Skype, if you need a hand let me know (jobs at ezidata.com.au) – I would be only too happy to assist!

Posted: Apr 16 2012, 07:01 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Windows Phone 7 | WP7

Sharing Your Internet Connection on a Windows Phone

We recently spent a week on vacation in Chiang Mai, Thailand. My wife had a couple of university assignments to submit and, as we wanted to use Skype as much as possible to keep in contact with family back home, having an internet connection was important.

Internet access at our hotel was charged at a ridiculous rate (80THB for 30-minutes) so as soon as we got to Chiang Mai we went to the mall, attached to the hotel and bought a DTAC ‘Happy Tourist’ SIM card. Having researched the Happy website, this looked like a good match for our needs as it had an option to get a full week of 3G internet for 199THB. The SIM comes in two varieties, 49THB or 99THB, the later with more included calls. The only problem was that the retailer sold us the 49THB SIM for 99THB, which I didn’t realise until we got back to the room and activated the card.

I put the SIM card into my old HTC Mozart, almost instantly got messages from Happy that our service was active and tried to connect to the internet. Although the phone had service, I couldn’t get on the internet so I called the service number and finally spoke to a customer service rep who advised me that I needed to restart the phone - damn why didn’t I think of that (maybe because I have never needed to restart the phone for anything else).

The Happy Tourist SIM gives you the first day’s internet connection for free, so we tested sharing the connection between my phone and laptop and it was working smoothly. We then milked our free internet for all that it was worth. 

Internet Sharing was rolled out to Windows Phone as part of the Mango update and you’ll find the option in the Settings menu. I believe it must also be supported by your carrier.  When you enable Internet Sharing, the phone creates a SSID for the Wi-Fi service and provides you with a password that you will need to use to connect from other devices.

Connection speeds here in Chiang Mai, even sharing the connection over Wi-Fi seem good. From the laptop tethered to my HTC www.speedtest.net said I was getting .98 Mbps down/.78Mbps up when connecting to Thailand-based servers. Connecting to servers in the USA, speedtest.adslthailand.com showed I was getting .78Mbps down/ .51Mbps up.

One disappointment with the Happy website is that you can’t top-up your account on the web using a credit card, so you need to purchase a top-up card from one of the retailers, such as 7-11.

You also appear to have to keep credit on your phone otherwise you lose your service. Even though we had already purchased the 7-day internet package, our phone balance hit 0 on the last day and no matter how hard I tried, I could not connect to the internet. As soon as I put another 100THB credit on the phone, the internet was up and running again.

 

Posted: Apr 14 2012, 22:04 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Windows Phone 7 | WP7

DataBinding HubTiles

In an earlier post I looked at adding data binding to a single HubTile control. In this post I'm going to take that to the next logical step and show you how to use data binding to create a dynamic set of HubTiles.

Like every Windows Phone control, it is possible to bind the properties of the HubTile control to values in a DataSource, such as a List or ObservableCollection. These DataSources could be located in the ViewModel portion of your app if you are using the MVVM pattern, but for this example we’ll bind our HubTiles to a local List. 

We'll reuse the HubTileItem class we built in the earlier post, but instead of creating just one item, we'll be building and data binding to a List<HubTileItem> object. The easy way to do this is to declare a local List  and then call a method that populates this List with values when the page loads.

Firstly, create a property named HubTiles, which will be of type List<HubTileItem>. This will hold our HubTileItems and will be used to data bind to the ListView.

private List<HubTileItem> hubTiles;
public List<HubTileItem> HubTiles
{
    get { return hubTiles; }
}

Next, create a method to add some items into our List of HubTileItems and call this method in the page constructor.

// Constructor
public MainPage()
{
    InitializeComponent();
 
    PopulateHubTiles();
}
 
private void PopulateHubTiles()
{
    hubTiles = new List<HubTileItem>();
 
    hubTiles.Add(
        new HubTileItem 
        { 
            Title = "Sam", 
            Message = "Yosemite Sam", 
            ImageUri = new Uri("/Assets/Images/Yosemite-Sam.jpg"UriKind.Relative) 
        });
    
 ...
    hubTiles.Add(
        new HubTileItem 
        { 
            Title = "Wiley", 
            Message = "Wiley Coyote", 
            ImageUri = new Uri("/Assets/Images/Wiley-Coyote.jpg"UriKind.Relative) 
        });
}

In XAML, create a new ListBox and add our data-bound HubTile to its ItemTemplate. 

<ListBox Grid.Row="0" Name="AvatarListView">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <toolkit:HubTile Margin="12,12,0,0" x:Name="MyHubTile"                                            
                        Title="{Binding Title}"
                        Message="{Binding Message}"
                        Source="{Binding ImageUri}">
            </toolkit:HubTile>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Once again we'll override the OnNavigatedTo event and add the code to assign our List property as the ItemsSource for the ListView.

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    AvatarListView.ItemsSource = HubTiles;
    base.OnNavigatedTo(e);
}

Run the app and you should see a nice list of HubTiles running down the page. 

The long list of HubTiles is probably not what you were expecting, but thankfully the Windows Phone Toolkit provides another control, called the WrapPanel that we can use to layout our tiles in a more visually appealing manner.

The WrapPanel is much like a StackPanel, but lays out items in both directions, that is Top-Bottom and Left-Right.

To utilise the WrapPanel in our ListView, all we need to do is add it as the ItemsPaneltemplate and set the orientation to Horizontal. The WrapPanel with then lay out the HubTiles Left-Right, then downwards.

<ListBox Grid.Row="0" Name="AvatarListView">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <toolkit:WrapPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <toolkit:HubTile Margin="12,12,0,0" x:Name="MyHubTile"                                            
                        Title="{Binding Title}"
                        Message="{Binding Message}"
                        Source="{Binding ImageUri}">
            </toolkit:HubTile>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

The result will be a nice little grid of HubTiles that will no-doubt make your app the talk of the town.

 

Posted: Mar 05 2012, 10:59 by CameronM | Comments (0) RSS comment feed |
  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Windows Phone 7 | WP7

New size options for HubTiles

One of the main visual changes to the start screen in Windows Phone 7.8 and 8 is that it now supports three sizes of live tiles. The default (medium) tile is now larger and gone is the black strip to the right that used to be home to an arrow that took you to the app screen. 

This milestone seemed like a good time to revisit the HubTile control from the Windows Phone Toolkit to see if it could support these new formats. The early versions on the HubTile is was a painful process to choose the size of the tile, having to resort to copying and modifying the XAML elements and animations, as discussed in the post. 

Thankfully, since the September 2012 release of the Windows Phone Toolkit, the HubTile control now comes with a Size property that allows you to select from four sizes, Default, Small, Medium and Large. A look at the source code for this release reveals the size of each of these tiles.

switch (hubTile.Size) 
{ 
    case TileSize.Default: 
        hubTile.Width = 173; 
        hubTile.Height = 173; 
        break; 
  
    case TileSize.Small: 
        hubTile.Width = 99; 
        hubTile.Height = 99; 
        break; 
  
    case TileSize.Medium: 
        hubTile.Width = 210; 
        hubTile.Height = 210; 
        break; 
  
    case TileSize.Large: 
        hubTile.Width = 432; 
        hubTile.Height = 210; 
        break; 
}

Using these new sizes with the data bound HubTile example we used in another post is simple. The easiest option is to specify the Size property in the ItemTemplate.

<ListBox Grid.Row="0" Name="AvatarListView">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <toolkit:WrapPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemTemplate>
        <DataTemplate>
            <toolkit:HubTile 
		Margin="12,12,0,0" 
		Title="{Binding Title}"
		Message="{Binding Message}"
		Source="{Binding ImageUri}"
                Size="Medium"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

Of course, you can also bind the Size property to property on your underlying data source. To do this, add a TileSize property to the HubTileItem class and modify the HubTile control XAML as below.

public class HubTileItem
{
    public string Title { getset; }
    public string Message { getset; }
    public Uri ImageUri { getset; }
    public TileSize TileSize {getset;}
}

<toolkit:HubTile 
	Margin="12,12,0,0" 
	Title="{Binding Title}"
	Message="{Binding Message}"
	Source="{Binding ImageUri}"
   	Size="{Binding TileSize}"/>

Posted: Feb 05 2012, 21:53 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Using the Bing Maps API in your WP7 App

A while ago I wrote a post detailing how easy it was to use the Bing Maps API to GeoCode an address, which enables you to get the geographical position (Latitude and Longitude) of a location when only given the street address.

This has been invaluable in a number of applications since then including the TrafficMATE app which used street addresses to help create Routes to check for traffic incidents. So how exactly can we get the Lat/Long for a location when only given the street address? Well thankfully it's easy.

As in the previous post, we need to start by adding a Service Reference to our project. The Bing Maps API service that deals with Geocoding is located at http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc

I called the reference Bing.Geocode, but feel free to call it whatever you like.

You will also need to get a developer key to use with the API, but don't worry that's easy too. Chances are that if you have already been using Bing Maps with the Map control in Windows Phone 7 then you already have one of these. If not, go get one at http://www.bingmapsportal.com/

The code that calls the Bing Maps Geocode service is fairly easy. In your XAML all you really need is a TextBox where the user can enter an address and then a Button they click to call the function.

//get lat/long for this address

GeocodeRequest request = new GeocodeRequest();

 

request.Credentials = new Credentials();

request.Credentials.ApplicationId = YourKey;

 

request.Query = this.TextBoxOrigin.Text;

 

GeocodeServiceClient client = new GeocodeServiceClient();

client.GeocodeCompleted += new EventHandler<GeocodeCompletedEventArgs>(client_GeocodeCompleted);

client.GeocodeAsync(request);

Then all you need to do is interrogate the results sent back from Bing in your GeocodeCompleted event handler.

void client_GeocodeCompleted(object sender, GeocodeCompletedEventArgs e)

{

    GeocodeResponse response = e.Result;

    if (response.Results.Count > 0)

    {

        MessageBox.Show(response.Results[0].Address.FormattedAddress);

    }

}

As you can see from the code above, I am simply selecting the first record in the Results array and displaying the Address.FormattedAddress property. Other properties that may be useful are Address.Locality (AKA:Suburb) Address.AdminDistrict (AKA:State).

The other important fields that you will want to process are the Lat and Long. These are contained within the Location array in fields aptly named Latitude and Longitude. These could be easily returned using the syntax response.Results[0]Location[0]Latitude and response.Results[0]Location[0]Longitude.

Posted: Jan 06 2012, 07:06 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Windows Phone 7 | WP7

Handling Pushpins selection with the WP7 Map control

As mentioned in the previous post, one of the benefits of using your own custom business objects as the data source for your Map control Pushpin layer is that you can access all the information about the item you select.

So how do we get back a single Camera object when a user presses on a pushpin? Well thankfully this is very easy. By using a List<Camera> as the ItemSource for the MapsItemControl control containing our Pushpins we are able to extract the data back when the user presses the Pushpin.

There are a number of methods you can use that are triggered when the user clicks or taps on the screen, but in this example we will use the new ‘Tap’ event, made available in the Mango release. The map xaml has been covered in the previous post, but now all we need to do is add the Tap event handler such as:

<my:Pushpin Location="{Binding Location}" Tap="Pushpin_Tap" >

</my:Pushpin>

The key to unlocking all the goodness obtained by binding the pushpins to your own objects is to realise that the DataContext of the Pushpin actually contains your business object.

private void Pushpin_Tap(object sender, System.Windows.Input.GestureEventArgs e)

{

var pushpin = sender as Pushpin;

 

Camera cam= (Camera)pushpin.DataContext;

MessageBox.Show(cam.Name);

}


In this example we can direct cast the Pushpin.DataContext to our business object, which in this example is called Camera. Once we have a Camera object, we can access any of the properties and methods associated with it.

Obviously you could do a lot more than simply displaying a message when the Pushpin is selected, for example you could navigate to another page displaying information relevant to the selected Pushpin.

 

Posted: Dec 23 2011, 07:14 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: WP7

Using Business Objects with the WP7 Map Control

One aspect of creating and adding pushpins to the Windows Phone 7 Map control that turned out to be a welcome revelation to me is that most geo-centric Business Objects can be used as the data source for the pushpin layer with little or no modification.

In a previous post we looked at how easy it was to add a single pushpin to the Map control. If we look at that method again, we see that all we really need is a geographical location. This means that as long as your object has a Latitude and Longitude, you can use it as a pushpin.

This was very handy in TrafficMATE especially when displaying camera locations on a map. The Camera object model we created already contained the Lat/Long of the camera. This meant that I could easily use a List<Camera> object as the ItemSource for the pushpin layer.

Here’s the xaml for a map showing camera locations.

<my:Map x:Name="CameraMap"

    CredentialsProvider="{Binding CredentialsProvider}"

    CopyrightVisibility="Collapsed"

    LogoVisibility="Collapsed"

    ZoomLevel="16">

    <my:Map.Foreground>

        <SolidColorBrush Color="{StaticResource PhoneForegroundColor}"/>

    </my:Map.Foreground>

    <my:MapItemsControl x:Name="PushpinItems" Height="300">

        <my:MapItemsControl.ItemTemplate>

            <DataTemplate>

                <my:Pushpin Location="{Binding Location}" >

                </my:Pushpin>

            </DataTemplate>

        </my:MapItemsControl.ItemTemplate>

    </my:MapItemsControl>

</my:Map>

The code that is of interest to us is the section defining the MapItemsContol named PushpinItems. Just like the other WP7 databindable controls, the MapItemsControl supports an ItemTemplate, which in this example is made up of Pushpin controls.

The Location property of the Pushpin, which is of type GeoCoordinate, is bound to a field in our data source called ‘Location’. All we need to support binding is ensure our business object exposes a GeoCoordinate property and we are good to go. A simplified version of the Camera object is shown below.

public class Camera

{

    public string Name { get; set; }

    public string Description { get; set; }

    public double Latitude { get; set; }

    public double Longitude { get; set; }

 

    public GeoCoordinate Location

    {

        get { return new GeoCoordinate(this.Latitude, this.Longitude); }

    }

}

With the help of an async call to a webservice, I populated a List<Camera> with relevant results and was able to set the ItemSource for the pushpin layer using something like:

PushpinItems.ItemsSource = cameras;

The key benefit of binding your objects directly to the pushpin layer is that you have direct access to the object whenever you select a pushpin. There is no need to make a second trip to the webservice when the user selects a pushpin - you already know everything there is to know about the underlying object. In a future post, I will explore how you can retrieve the underlying information from a Pushpin created using your business objects.

Posted: Dec 22 2011, 05:09 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Windows Phone 7 | WP7

Augmented Reality#3: Using the Geo AR (Augmented Reality) Toolkit

Now if you have been following along on some of my previous posts about Augmented Reality (AR), you’ll know that the Mango release of Windows Phone offers some great support for developers. So far we have looked at displaying the live video feed from the VideoBrush and also added some Accelerometer features to create a see-through spirit level.

With the release of the Geo Augmented Reality Toolkit (GART), many of the operations required to show geographical points in relation to the user’s current position have been greatly simplified.

First things first, you’ll need to download the GART binary from Codeplex. There are also a number of samples available for download which will help you on your way. Once you’ve downloaded and extracted the dll, you can add a reference to GART into your existing projects and be on your way to easier Augmented Reality apps.

Start a new Silverlight for Windows Phone – Windows Phone Application project in Visual Studio.  Make sure to select Windows Phone 7.1 for the OS when you are offered the choice.
Add a reference to GART to your project and add a the following to you MainPage.xaml

xmlns:ARControls="clr-namespace:GART.Controls;assembly=GART" 

You will also need to add a reference to System.Device to be able to include Location functionality, such as the GeoCoordinate class.

At the heart of GART is the ARDisplay control, which packages together a number of UI elements, as well as lots of complex calculations to make working with AR apps very easy.  The first UI elements we will look at are the OverheadMap and WorldView components.

The OverheadMap element renders just like the regular Map control and displays a Bing map. The WorldView element displays the geographical points in three dimensional space and lies at the heart of any good AR app.

The simplest way to get started with GART is to start by adding a few GeoCoordinate points to the ARDisplay control and checking the results using the OverheadMap UI element. To achieve this, add the ARDisplay control to your MainPage.xaml.

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <ARControls:ARDisplay x:Name="ARDisplay" d:LayoutOverrides="Width">
        <ARControls:OverheadMap x:Name="OverheadMap" />
        <ARControls:WorldView x:Name="WorldView" />
    </ARControls:ARDisplay>
</Grid>

In the code behind, add a few points that you want to show as labels on your new AR app. If you are using the emulator your “current” location will be set to the Microsoft campus in Redmond, so make sure the points you select are located nearby. Currently the Worldview only shows points within 100 meters of your current location.

You can use the AddLabel code from the GART samples to display the GeoCoordinate points you create using this sort of code;

GeoCoordinate pt4 = new GeoCoordinate(47.64523, -122.14090);

AddLabel(pt4, "Studio E");

Now that we have some geographical points we want to display and have set the current location to use for the centre of the ARDisplay, all that is left is to tell the ARDisplay to start running - you can add this code the OnNavigateTo event if you always want to start the control.

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)

{

    // Start AR services

    ARDisplay.StartServices();

 

    base.OnNavigatedTo(e);

}

Run the project, but be warned, AR functionality is really only useful when testing on a real device. If you are using the emulator you will get the great map shown below, complete with some strange text that overlaps each other.

Posted: Nov 10 2011, 06:23 by CameronM | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Windows Phone 7 | WP7