A “Quick And Dirty” Live Mesh Silverlight Application

After the LiveFX application I showed yesterday, I will now do the same but for a Silverlight Mesh App, so this would actually appear in your Live Desktop. Like yesterday’s tutorial, this is only really for those who have been given access to the LiveFX and Mesh SDK ‘bits’ at the moment, but when it does eventually go live for all developers, then you’ll be able to use the same tutorial.

Again, I will make the assumption you have all the SDK bits installed. Now, first off you need to create a Mesh-enabled project on the Azure Services Developer Portal. Then create a new Mesh Silverlight project in Visual Studio 2008:


In the solution you have a manifest.xml file, this holds some of the details for the project; this will get uploaded with your project. In this instance, mine looks like this:

<Manifest xmlns="http://schemas.mesh.com/application/manifest/2008">
  <Description>Live Framework Silverlight Mesh-enabled Web Application</Description>

For this Mesh App, all I will be doing is a simple Silverlight application that simply has a TextBlock and we will use the LiveFX to just insert some details into that TextBlock (the same details I used for the Console app).


Now, the code; in the console app, you will remember that we had to call loe.Connect() and provide some credentials, however, with an actual Mesh app, this isn’t required as that is all done automatically, so we can go ahead and just code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.LiveFX.Client;
using Microsoft.LiveFX.ResourceModel;

namespace LiveSideMeshAppSilverlight
    public partial class Page : UserControl
        public Page()

            MeshApplicationService meshApp = Application.Current.GetMeshApplicationService();
            // once mesh contents are loaded we get callback
            meshApp.LoadCompleted += new EventHandler(meshAppLoaded);
            // Create a new instance of the LOE referencing what we get
            // given from the Mesh Service. Note that we do not need to call
            // loe.Connect() as it is already connected.
            LiveOperatingEnvironment loe = meshApp.LiveOperatingEnvironment;

            // This gets the Messenger PSM
            //Profile prof = loe.Profiles.Entries.Single(e => e.Resource.Title == "GeneralProfile");
            //var somethingelse = (GeneralProfile)prof.Resource.ProfileInfo;

            // Start writing the string to put in the TextBlock
            string text = string.Empty;
            text += "Details for " + loe.Mesh.ProvisionedUser.Name + "n";
            text += "Email Address: " + loe.Mesh.ProvisionedUser.Email + "n";
            //text += "Messenger PSM: " + somethingelse.PersonalStatusMessage + "n";
            text += "Number of contacts: " + loe.Contacts.Entries.Count() + ".";

            // Set the TextBlock text
            MyTextBlock.Text = text;

(One thing to note about this code, I have had to comment out the bit of code that gets the Messenger PSM, this is due to a bug that has been found in the LiveFX Silverlight library. Once this has been fixed, you could uncomment out that section.)

Now that we have the code in, we can then send it to the Mesh. The first time you do this for an application, you will need to follow a process. To start off with, you will need to sign in with your Windows Live ID, this should be your ID that has been provisioned for the Mesh developer CTP.

Next you need to upload the application package, so in your project page, click on the upload package button:


To get the location of the package, there is a nice link to click in Visual Studio:


This window comes up automatically. Once you have uploaded the application package you need to get the newly created Application Self Link, which can be found on the project page, and just put that into section 3 of the above window. Your project will then upload to the cloud:


A new browser window will then open and take you to your developer sandbox of the Live Desktop and preload your new application


And there you have it, your first Mesh App. Unfortunately, due to another bug, you can’t view your home made Mesh Apps on your desktop yet, as it signs you out of the Mesh Client as soon as you load it.