using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.WindowsLive.Id.Client; namespace WindowsLiveTest { public partial class Form1 : Form { Identity oID; IdentityManager oIDMgr; public Form1() { InitializeComponent(); oIDMgr = IdentityManager.CreateInstance("Xodus", "MyApp"); oID = oIDMgr.CreateIdentity(); /*//Get System time and write it DateTime currentSystemTime = DateTime.Now; lbl_time.Text = currentSystemTime.ToString(); */ } private void btn_loginOut_Click(object sender, EventArgs e) { if (!oID.IsAuthenticated) { oID.Authenticate(); } else { oID.CloseIdentityHandle(); } updateScreen(); } private void btn_Exit_Click(object sender, EventArgs e) { if (!oID.IsAuthenticated) { oID.CloseIdentityHandle(); } this.Close(); } private void updateScreen() { if (oID.IsAuthenticated) { //If the use is logged on, look like this: lbl_strp_status.Text = "Logged on!"; btn_loginOut.Text = "Logout"; } else if (!oID.IsAuthenticated) { //Stuff... Maybe I should add that here :) lbl_strp_status.Text = "Logged out"; btn_loginOut.Text = "Login"; } } } }