public static void ConnectAllIrcInstances()
{
foreach (Instance instance in Instances.Values)
{
// connect it to irc
instance.Init();
}
// now we need to wait for all instances to connect
Syslog.Log("Waiting for all instances to connect to irc");
bool IsOk = false;
while (!IsOk)
{
foreach (Instance instance in Instances.Values)
{
if (!instance.IsWorking)
{
Syslog.DebugLog("Waiting for " + instance.Nick, 2);
Thread.Sleep(1000);
IsOk = false;
break;
}
Syslog.DebugLog("Connected to " + instance.Nick, 6);
IsOk = true;
}
}
// wait for all instances to join their channels
Syslog.Log("Waiting for all instances to join channels");
IsOk = false;
while (!IsOk)
{
foreach (Instance instance in Instances.Values)
{
if (!instance.ChannelsJoined)
{
Thread.Sleep(100);
IsOk = false;
break;
}
IsOk = true;
}
}
Syslog.Log("All instances joined their channels");
}