About Me

My photo
Northglenn, Colorado, United States
I'm primarily a BI Developer on the Microsoft stack. I do sometimes touch upon other Microsoft stacks ( web development, application development, and sql server development).

Thursday, March 23, 2006

AIM Plugin: Sign Off Timer

So this is my first AIM Plugin ever developed, yeah me.

It basically allows the user to set how many minutes he/she would like to stay online. When this time is reached, a pop-up box is displayed and you are signed off. I remember when I was a college student, and I would be almost late for class because I was on AIM losing track of time.

Here is the website where you can download it: http://williamandrus.tripod.com/AIMPlugin.html

I set it up so that the timer would run on it's own thread, that way it won't interfere with the AIM's thread. So in the Exec function I have this little sniplet:

if(command == kCommandId)
{
   Thread t = new Thread((new
ThreadStart(StartTimer)));
   t.Start();
}


this then calls my function called StartTimer:

public void StartTimer()
{
   TimeSelect timer = new TimeSelect(m_session);
   timer.ShowDialog();
}

this then starts up another file which I used to make the form. Here is a sniplet from that program:

private void buttonOK_Click(object sender, System.EventArgs e)
{
   CountDown = Convert.ToInt32(this.numericUpDownMinutes.Value);
   this.Visible = false;
   while(CountDown != 0)
   {
      Application.DoEvents();
   }
   MessageBox.Show("You haved been signed off
by the timer.","Sign Off Timer");
   this.session.SignOff();
}

private void timeKeeper_Tick(object sender, EventArgs e)
{
   if(sender == this.timeKeeper)
   {
      this.CountDown--;
   }
}

No comments: