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;
using Meebey.SmartIrc4net;
using System.Xml;
using System.Threading;
namespace IRC_Client
{
public partial class Form1 : Form
{
Identity oID;
IdentityManager oIDMgr;
// public IrcClient irc = new IrcClient();
ircWindow ircWin = new ircWindow();
public Form1()
{
InitializeComponent();
oIDMgr = IdentityManager.CreateInstance("Xodus", "LiveID IRC Client");
oID = oIDMgr.CreateIdentity();
lst_server.Hide();
rtb_Chan.ReadOnly = true;
/*//Get System time and write it
DateTime currentSystemTime = DateTime.Now;
lbl_time.Text = currentSystemTime.ToString();
*/
}
private void btn_loginOut_Click_1(object sender, EventArgs e)
{
if (!oID.IsAuthenticated)
{
oID.Authenticate();
}
else
{
oID.CloseIdentityHandle();
}
updateScreen();
}
private void btn_Exit_Click_1(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 to Live Server";
btn_loginOut.Text = "Logout";
lst_server.Show();
if (ircWin.isConnected)
{
lbl_strip_ircStatus.Text = "Connected to IRC";
btn_DisconnectIRC.Show();
btn_Connect.Show();
btn_DisconnectIRC.Enabled = true;
btn_Connect.Enabled = false;
}
if (ircWin.isConnected == false)
{
btn_DisconnectIRC.Enabled = false;
btn_Connect.Enabled = true;
lbl_strip_ircStatus.Text = "Logged out of IRC";
lbl_strip_Nick.Text = ircWin.nick;
lbl_strip_Server.Text = ircWin.server;
}
}
else if (!oID.IsAuthenticated)
{
//Stuff... Maybe I should add that here :)
lbl_strp_status.Text = "Logged out";
btn_loginOut.Text = "Login";
btn_Connect.Hide();
btn_DisconnectIRC.Hide();
lst_server.Hide();
}
}
private void btn_Connect_Click(object sender, EventArgs e)
{
if (oID.IsAuthenticated)
{
ircWin.login();
updateScreen();
}
else MessageBox.Show("You must connect to the live service before Connecting to IRC!");
}
private void btn_DisconnectIRC_Click(object sender, EventArgs e)
{
ircWin.logout();
updateScreen();
}
public static void OnQueryMessage(object sender, IrcEventArgs e)
{
}
}
}