private void EdgeDistTB_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { OkBTN.PerformClick(); } else if (e.KeyCode == Keys.Escape) { CancelBTN.PerformClick(); } }
/// <summary> /// Reports the results of the open session operation. /// </summary> private void OpenComplete(object e) { if (InvokeRequired) { BeginInvoke(new WaitCallback(OpenComplete), e); return; } if (IsDisposed) { return; } try { Cursor = Cursors.Default; ServiceResultException sre = e as ServiceResultException; if (sre != null) { if (m_checkDomain && sre.StatusCode == StatusCodes.BadCertificateHostNameInvalid) { StringBuilder buffer = new StringBuilder(); buffer.AppendFormat(sre.Message); buffer.AppendFormat("\r\n\r\nRetry without certificate hostname validation?"); DialogResult result = MessageBox.Show( buffer.ToString(), "Exception: BadCertificateHostNameInvalid", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { m_checkDomain = false; OkBTN.Enabled = true; OkBTN.PerformClick(); return; } DialogResult = DialogResult.OK; return; } } if (e != null) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), (Exception)e); } if (m_session.Connected && m_session.SessionTimeout < 1000) { DialogResult result = MessageBox.Show( "Warning: the session time out might be too small: " + m_session.SessionTimeout, "Session revised timeout", MessageBoxButtons.OK, MessageBoxIcon.Warning); } DialogResult = DialogResult.OK; } finally { CancelBTN.Enabled = true; OkBTN.Enabled = true; } }