private void OnConnectionRejected(object sender, RejectedConnectionEventArgs e) { if (messanger != null && justStarting) { messanger.SendToChannel("Gablarski connection rejected: " + e.Reason); } }
private void GablarskiConnectionRejected(object sender, RejectedConnectionEventArgs e) { e.Reconnect = false; switch (e.Reason) { case ConnectionRejectedReason.CouldNotConnect: if (this.reconnecting) { e.Reconnect = true; } else { Invoke((Action)(() => { if (MessageBox.Show(this, "Could not connect to the server", "Connecting", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Retry) { e.Reconnect = !this.shuttingDown; } else { ShowConnect(true); } })); } break; case ConnectionRejectedReason.CouldNotResolve: BeginInvoke((Action)(() => MessageBox.Show("Error resolving hostname", "Connecting", MessageBoxButtons.OK, MessageBoxIcon.Warning))); break; case ConnectionRejectedReason.IncompatibleVersion: BeginInvoke((Action)(() => MessageBox.Show(this, "Connecting to the server failed because it is running a newer version of Gablarski than you are.", "Connecting", MessageBoxButtons.OK, MessageBoxIcon.Warning))); break; default: MessageBox.Show(e.Reason.ToString()); break; } }
private void GablarskiConnectionRejected (object sender, RejectedConnectionEventArgs e) { e.Reconnect = false; switch (e.Reason) { case ConnectionRejectedReason.CouldNotConnect: if (this.reconnecting) e.Reconnect = true; else { Invoke ((Action)(() => { if (MessageBox.Show (this, "Could not connect to the server", "Connecting", MessageBoxButtons.RetryCancel,MessageBoxIcon.Warning) == DialogResult.Retry) e.Reconnect = !this.shuttingDown; else ShowConnect (true); })); } break; case ConnectionRejectedReason.CouldNotResolve: BeginInvoke ((Action)(() => MessageBox.Show ("Error resolving hostname", "Connecting", MessageBoxButtons.OK, MessageBoxIcon.Warning))); break; case ConnectionRejectedReason.IncompatibleVersion: BeginInvoke ((Action)(() => MessageBox.Show (this, "Connecting to the server failed because it is running a newer version of Gablarski than you are.", "Connecting", MessageBoxButtons.OK, MessageBoxIcon.Warning))); break; default: MessageBox.Show (e.Reason.ToString()); break; } }