For Programmers: Free Programming Magazines  


Home > Archive > C# > June 2006 > Displaying forms for a certain time period









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Displaying forms for a certain time period
Al Wilkerson

2006-06-17, 7:02 pm

Hey,

Does anyone know how to display a particular form for a certain length of
time using a timer object, and then display another form afterwards ?

In the following code snippet I want to display BroadCaster form (only)
while I'm running the "Finding Servers" code, for a 5 seconds, after this
time, I want to display the ClassSelector form.
Right now, when the this.form loads both forms load with the BroadCaster
form in back of the ClassSelector form..

Form_Load (object sender, EventArgs e)
{
using (serviceTimer = new System.Threading.Timer(new
TimerCallback(FindingServers),null, 0,5000))
{

BroadCast();

}
broadCaster.Close();
DisplayClassSelector();
}

private void BroadCast()

// private void BroadCast(object sender,EventArgs e)

{

broadCaster = new BroadCaster();

broadCaster.MdiParent = this;

broadCaster.Show();

broadCaster.BringToFront();

}

private void DisplayClassSelector()
{

ClassSelector classSelector = new ClassSelector(cstrClassData);

classSelector.MdiParent = this;

classSelector.Show();

classSelector.BringToFront();

}



private void FindingServers(object state)

{

// AutoResetEvent autoEvent = (AutoResetEvent)state;



if (Utility.IsNetworkConnected())

{

if (FindServers())

cblnServerFound = true;

}

}



Thanks,


--
Al


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com