private void btnScan_Click(object sender, EventArgs e) { EnableNoButton(); try { uint sign = ConnectHelp.G3_ReadCSQ(); SetSign((int)sign); } catch (Exception ex) { VirtualConsole(false, ex.Message, 0); } finally { EnableYesButton(); } }
protected override void WndProc(ref Microsoft.WindowsCE.Forms.Message m) { if (m.Msg == WM_RASDIALEVENT) { switch ((tagRASCONNSTATE)m.WParam) { case tagRASCONNSTATE.RASCS_OpenPort: break; case tagRASCONNSTATE.RASCS_PortOpened: VirtualConsole(false, "端口已打开", 0); break; case tagRASCONNSTATE.RASCS_ConnectDevice: VirtualConsole(false, "正在连接设备", 0); break; case tagRASCONNSTATE.RASCS_DeviceConnected: VirtualConsole(false, "设备已连接", 0); break; case tagRASCONNSTATE.RASCS_AllDevicesConnected: VirtualConsole(false, "物理连接已建立", 0); break; case tagRASCONNSTATE.RASCS_Authenticate: VirtualConsole(false, "正在验证...", 0); break; case tagRASCONNSTATE.RASCS_AuthNotify: VirtualConsole(false, "验证出错", 0); break; case tagRASCONNSTATE.RASCS_AuthRetry: VirtualConsole(false, "正在重新验证...", 0); break; case tagRASCONNSTATE.RASCS_AuthCallback: break; case tagRASCONNSTATE.RASCS_AuthChangePassword: break; case tagRASCONNSTATE.RASCS_AuthProject: break; case tagRASCONNSTATE.RASCS_AuthLinkSpeed: break; case tagRASCONNSTATE.RASCS_AuthAck: break; case tagRASCONNSTATE.RASCS_ReAuthenticate: VirtualConsole(false, "正在重新验证...", 0); break; case tagRASCONNSTATE.RASCS_Authenticated: VirtualConsole(false, "验证已通过", 0); break; case tagRASCONNSTATE.RASCS_PrepareForCallback: break; case tagRASCONNSTATE.RASCS_WaitForModemReset: break; case tagRASCONNSTATE.RASCS_WaitForCallback: break; case tagRASCONNSTATE.RASCS_Projected: break; case tagRASCONNSTATE.RASCS_Interactive: break; case tagRASCONNSTATE.RASCS_RetryAuthentication: break; case tagRASCONNSTATE.RASCS_CallbackSetByCaller: break; case tagRASCONNSTATE.RASCS_PasswordExpired: break; case tagRASCONNSTATE.RASCS_Connected: uint sign = ConnectHelp.G3_ReadCSQ(); string stemp = "网络已连接,信号强度:" + sign.ToString(); VirtualConsole(false, stemp, 0); ConnectHelp.isConencting = false; break; case tagRASCONNSTATE.RASCS_Disconnected: VirtualConsole(false, "网络连接失败", 0); ConnectHelp.isConencting = false; break; default: base.WndProc(ref m); //一定要调用基类函数,以便系统处理其它消息。 break; } } base.WndProc(ref m);//一定要调用基类函数,以便系统处理其它消息。 }