private bool asyncScanCmd() { try { string str = CServerWrapper.getScanMsg(mInstanceID); if (str == null) { return(false); } if (str == "") { return(false); } if (timerScanCommand.Tag != null && timerScanCommand.Tag.ToString().Equals(str)) { return(false); } timerScanCommand.Tag = str; Console.WriteLine("扫描指令" + str); //timerCommand.InvokeIfRequired(l => l.Tag = str); return(true); } catch (Exception e) { return(false); } }
private void btnOK_Click(object sender, EventArgs e) { if (textBoxX1.Text.Length == 0 || textBoxX2.Text.Length == 0) { btnOK.Enabled = false; return; } CGisDataSettings.gCurrentProject.projectUrl = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectUrl;//ipAddressInput1.Value; CGisDataSettings.gCurrentProject.userName = textBoxX1.Text.Trim(); CGisDataSettings.gCurrentProject.userPSD = textBoxX2.Text.Trim(); CGisDataSettings.gCurrentProject.projectLocalPath = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectLocalPath; CServerWrapper.ConnectToServer(CGisDataSettings.gCurrentProject.projectUrl); //string url = "http://" + GlobalSettings.gProjectUrl + "/webservice/usrlogin.asmx"; string resultStr = null; if (CServerWrapper.isConnected) { resultStr = CServerWrapper.webLogin(CGisDataSettings.gCurrentProject.userName, CGisDataSettings.gCurrentProject.userPSD); } //try //{ // WebServiceAgent ag = new WebServiceAgent(url); // resultStr = (string)ag.Invoke("CheckUsrLogin", GlobalSettings.gUserName, GlobalSettings.gUserPWD); //} //catch (System.Exception ex) //{ // MessageBox.Show(ex.ToString().Split('\n')[0]); //} //finally //{ if (resultStr == "µÇ¼³É¹¦") { CGisDataSettings.UpdateConfigInfo(); this.DialogResult = DialogResult.OK; // Setting the DialogResult, will close the dialog, and the ShowDialog call will return. } else if (resultStr != null) { MessageBox.Show("Wrong User Name or Password"); Environment.Exit(-1); //this.DialogResult } else { MessageBox.Show("No response from remote server, using local database instead"); this.DialogResult = DialogResult.OK; } this.btnOK.Enabled = true; //} //GlobalVar.useLocalDB = true; //this.DialogResult = DialogResult.OK; }
void handleScanCmd(IAsyncResult ar) { //AsyncScanCmdDelegate dlgt = (AsyncScanCmdDelegate)ar.AsyncState; //int speed; if (mdlgt.EndInvoke(ar)) { if (handleScanCmd(timerScanCommand.Tag.ToString())) { CServerWrapper.setScanMsg(mInstanceID, "NavCmdSettled"); //timerScanCommand.Stop(); //timerScanCommand.Interval = 1000; //timerScanCommand.Start(); mCmdStatus = ScanCommandStatus.Commanding; } } }
private void btnOK_Click(object sender, EventArgs e) { CGisDataSettings.gCurrentProject.projectUrl = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectUrl;//ipAddressInput1.Value; CGisDataSettings.gCurrentProject.userName = textBoxX1.Text.Trim(); CGisDataSettings.gCurrentProject.userPSD = textBoxX2.Text.Trim(); CGisDataSettings.gCurrentProject.projectLocalPath = CGisDataSettings.gProjectList[comboBoxEx1.SelectedIndex].projectLocalPath; CServerWrapper.isConnected = !(checkBoxX1.CheckState == CheckState.Checked); if (CServerWrapper.isConnected) { CServerWrapper.isConnected = CServerWrapper.ConnectToServer(CGisDataSettings.gCurrentProject.projectUrl); } //string url = "http://" + GlobalSettings.gProjectUrl + "/webservice/usrlogin.asmx"; string resultStr = null; if (CServerWrapper.isConnected) { resultStr = CServerWrapper.webLogin(CGisDataSettings.gCurrentProject.userName, CGisDataSettings.gCurrentProject.userPSD); if (resultStr == "登录成功") { CGisDataSettings.UpdateConfigInfo(); this.DialogResult = DialogResult.OK; // Setting the DialogResult, will close the dialog, and the ShowDialog call will return. } else if (resultStr != null) { MessageBox.Show("用户名或密码错误"); //Environment.Exit(-1); //this.DialogResult } } else { MessageBox.Show("脱机状态使用本系统"); CGisDataSettings.UpdateConfigInfo(); this.DialogResult = DialogResult.OK; } //this.btnOK.Enabled = true; //} //GlobalVar.useLocalDB = true; //this.DialogResult = DialogResult.OK; }