Join LiveSide!
Sign In using: Name/Password OpenID
or Live ID: Sign In Live ID
0 out of 8,034 members
are online, & 13 guest(s).

Recent Comments

–cJr
re: A “Quick And Dirty” Console Application Using The LiveFX

Log in or Join to leave a comment!

LiveSide on Mobile

Our latest posts and our favorite links,
all on your phone or mobile device
Visit m.LiveSide.net
Or go to www.LiveSide.net
on your mobile device and we'll redirect you!

Tweets We Like

Loading...

LiveSide Time

Redmond

Dallas (server)

London

Shanghai

Windows Live Calendar

PDC LA Nov 17-19

   www.microsoftpdc.com

Follow us on Facebook

    LiveSide.net
   
    Promote Your Page Too

  • LiveSide on the Windows Live Network
  • LiveSide on Facebook
  • LiveSide on Twitter
  • LiveSide RSS  
  • Windows Live Alerts
  •  
  • feedburner
  •  
LiveSide - Developer Blog

A “Quick And Dirty” Console Application Using The LiveFX

This post is really just a starting point on using the LiveFX. Now, although I’ll show you a quick application, you won’t be able to use any of this just yet unless you have been given a LiveFX token (which you would redeem at the Azure Dev Portal). This framework also works with the Live Mesh client, although you don’t need Live Mesh to be installed for it to work.

For this simple demo, I’ll do a console application that will print out my name, my email address (which will be blurred :P ), my current Messenger PSM (Personal Message Status), and the number of contacts I have.

Because this is mainly for those who already have access to the LiveFX ‘bits’ I will assume at this point that you have already downloaded and installed the relevant prerequisites.

The code for this is very simple:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.LiveFX.ResourceModel;
using Microsoft.LiveFX.Client;
using System.Net;

namespace MeshConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            LiveOperatingEnvironment loe = new LiveOperatingEnvironment();
            string uriResponse = "https://user-ctp.windows.net";
            NetworkCredential creds = new NetworkCredential("WLID",
                                                            "PASSWORD",
                                                            uriResponse);
            loe.Connect(creds);
            
            // This gets the Messenger PSM
            Profile prof = loe.Profiles.Entries.Single(e => e.Resource.Title == "GeneralProfile");
            var _messengerPSM = (GeneralProfile)prof.Resource.ProfileInfo;
            
            // Prints the user's name
            Console.WriteLine("Details for " + loe.Mesh.ProvisionedUser.Name);
            // Prints the email address
            Console.WriteLine("Email Address: " + loe.Mesh.ProvisionedUser.Email);
            // Prints the Messenger PSM (gained above)
            Console.WriteLine("Messenger PSM: " + _messengerPSM.PersonalStatusMessage);
            // Prints the number of contacts I have with this WLID
            Console.WriteLine("Number of contacts: " + loe.Contacts.Entries.Count());
            
            Console.ReadLine();
            
        }
    }
}

Now, in the NetworkCredential object you would put your WLID and password in (mine are removed for obvious reasons). The results of this look as follows:

LiveFXConsoleAppScreenshot
MessengerPSMStatus

As you can see, the PSM taking what mine currently says.

This is only really scratching the surface of what the LiveFX can actually do but is a nice way to quickly get started.

SL

Comments

cJr wrote re: A “Quick And Dirty” Console Application Using The LiveFX
on Mon, Nov 10 2008 6:29 PM

Very handy post Scott, thank you very much.

Sign In Live ID using Live ID, Name/Password, or OpenID
or Join LiveSide to leave a comment!