private void JoinChannelBW_done(object sender, RunWorkerCompletedEventArgs e) { Enabled = true; switch (joinResult) { case Colloquor.ColloquorClient.CQUORJoinResult.TIMEOUT: MessageBox.Show("Server timed out. Close the connection and try to reconnect", "Woops", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case Colloquor.ColloquorClient.CQUORJoinResult.UNKNOWN: MessageBox.Show("An Unknown error occurred while connecting to this channel", "Woops", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case Colloquor.ColloquorClient.CQUORJoinResult.ALREADY: if (MessageBox.Show("You're already connected on a different Colloquor Client! Force leave on the other client?", "Woops", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { MainClient.Leave(); MessageBox.Show("OK, Your account was kicked from the channel it was in. Try to join a channel again now.", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information); } ; break; case Colloquor.ColloquorClient.CQUORJoinResult.NOTFOUND: MessageBox.Show("Uh oh the channel wasn't found! Did someone modify the settings?", "Woops", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case Colloquor.ColloquorClient.CQUORJoinResult.NEEDPASS: MessageBox.Show("This channel needs a password", "Woops", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case Colloquor.ColloquorClient.CQUORJoinResult.WRONGPASS: MessageBox.Show("Incorrect Password", "Woops", MessageBoxButtons.OK, MessageBoxIcon.Error); break; case Colloquor.ColloquorClient.CQUORJoinResult.SUCCESS: Hide(); new MainForm(ref MainClient, ChannelsListbox.SelectedItem.ToString()).ShowDialog(); if (!MainClient.Connected) { Close(); } //Catch if timed out else { try { MainClient.Leave(); } catch (InvalidOperationException) { } Show(); } //Catch if kicked due to leave. break; default: break; } }
private void ChatboxKeepUpdated_Done(object sender, RunWorkerCompletedEventArgs e) { switch (CKUR) { case ChatboxKeepUpdatedResult.TIMEOUT: MessageBox.Show("Server connection timeout. Log in again", "Woops", MessageBoxButtons.OK, MessageBoxIcon.Error); Mainclient.Close(); Close(); break; case ChatboxKeepUpdatedResult.KICKED: if (!AlreadyClosed) { MessageBox.Show("You've been kicked from this channel", "Algo paso", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } break; case ChatboxKeepUpdatedResult.NORMAL_EXIT: break; default: MessageBox.Show("Chatbox Keep Update Routine abruptly closed. Kicking you from the chatroom", "Algo paso", MessageBoxButtons.OK, MessageBoxIcon.Error); try { Mainclient.Leave(); } catch { }; //try in case the abrupt disconnection caused them to already leave. Close(); break; } }