Getting Started with the Live Framework

If you attended my DevWeek session “An Intro to Live Mesh Development” (a name of historical significance as it was proposed before PDC and therefore before the Live Framework was announced – it’s always difficult coming up with sessions so far in advance) then I promised to share the little demo I built in the hope it might help get you up and running.

DevWeek Demo

There are lots of shortcuts in there. Even the way I connect to the Live Operating Environment is less than ideal – you’re always making sacrifices in demos either for the sake of time or clarity – so accept the fact it’s flawed or don’t open it. I wont be entertaining any refunds okay?

First, get yourself over to https://dev.live.com/liveframework and follow the instructions to:

  1. Download the Live Framework SDK April 2009 CTP (you wont need the VS tools unless you want to build a MEWA)
  2. Provision your account on the Azure Services Developer Portal
  3. Note – before you continue, if you want to run the Live Framework Client side by side with Live Mesh, follow the instruction here before you continue to step 4
  4. Install the Live Framework Client on your machine - https://developer.mesh-ctp.com

There is a much more detailed post on the Live Framework blog.

Once you’ve done that, you should have all the components required to connect the “mesh”.

As a test, create a Console application, add a reference to the three .NET Toolkit assemblies (in %ProgramFiles%\Microsoft SDKs\Live Framework\v0.91\API Toolkits\.Net Library\) and add the following code. Change Username / Password to the LiveId that you’re registered for Live Framework access (point 2 above). When you run you should get a list of the surnames of the contacts for that LiveId.

 using System;
using System.Net;
using Microsoft.LiveFX.Client;
using Microsoft.LiveFX.ResourceModel;

class Program
{
 static void Main(string[] args)
 {
       string Username = "Username";
       string Password = "Password";

       LiveOperatingEnvironment loe = new LiveOperatingEnvironment();
      LiveItemAccessOptions options = new LiveItemAccessOptions();

        string authToken = 
         new NetworkCredential(Username, Password).GetWindowsLiveAuthenticationToken();

      Uri serviceUrl = new Uri(@"https://user-ctp.windows.net");

      loe.Connect(authToken, AuthenticationTokenType.UserToken, serviceUrl, options);

     foreach (var item in loe.Contacts.Entries)
      {
           Console.WriteLine(item.Resource.FamilyName);
        }

       Console.ReadLine();
 }

}

If that works for you, I’ve attached the demo app I built in the DevWeek session. This allows you to connect either locally or to the cloud, load up a “DevWeekPiccies” mesh object (or create it if it doesn’t exist) and upload images to the mesh. You can see all the devices in your mesh and nominate the mesh object to sync to that device. You can also add other members (grant access to the mesh object and it’s datafeeds). The Resource Browser (installed with the SDK at %ProgramFiles%\Microsoft SDKs\Live Framework\v0.91\Tools\Live Framework Resource Browser) is a great way to see what’s being sync’d where. Open two instances of the app and you can see items being sync’d between cloud and local Live Operating Environment etc.

Technorati Tags: live framework,mesh,devweek

LiveFrameworkApp.zip