private void ConnectToAppServer_Loaded(object sender, RoutedEventArgs e) { App.DrawWindowsBackGround(this); ButtonApplicationMenu.ContextMenu = App.InitApplicationMenu(); App.GSystemMainWindow.IOperationEvent += GSystemMainWindow_IOperationEvent; ImageLinkToServer.Source = new BitmapImage(new Uri(System.IO.Path.Combine(App.GStrApplicationDirectory, @"Images\00000008.ico"), UriKind.RelativeOrAbsolute)); IStrVerificationCode001 = CreateVerificationCode(PFShareClassesC.EncryptionAndDecryption.UMPKeyAndIVType.M001); IStrVerificationCode101 = CreateVerificationCode(PFShareClassesC.EncryptionAndDecryption.UMPKeyAndIVType.M101); TextBoxServerPort.SetElementData("8081"); DisplayElementCharacters(false); InitConnectedServerList(); ComboBoxServerName.Focus(); }
/// <summary> /// 验证界面输入的连接信息是否正确 /// </summary> /// <param name="AStrReturn">返回错误码和错误信息 </param> /// <returns>True:验证正确; False:验证错误</returns> private bool ConfirmConnectParameter(ref string AStrReturn) { bool LBoolReturn = false; string LStrServerName = string.Empty; int LIntServerPort = 0; string LStrLoginName = string.Empty; string LStrLoginPassword = string.Empty; string LStrRememberPassword = "******"; int LIntNetworkProtocolIndex = 1; string LStrNetworkProtocol = string.Empty; int LIntConnectionTimeOut = 60; int LIntExcutionTimeOut = 0; try { IListConnectInfo.Clear(); LStrServerName = ComboBoxServerName.Text.Trim(); if (string.IsNullOrEmpty(LStrServerName)) { AStrReturn = "E001001" + App.GStrSpliterChar; ComboBoxServerName.Focus(); return(LBoolReturn); } if (!int.TryParse(TextBoxServerPort.GetElementData().Trim(), out LIntServerPort)) { AStrReturn = "E001002" + App.GStrSpliterChar; TextBoxServerPort.Focus(); return(LBoolReturn); } if (LIntServerPort <= 10) { AStrReturn = "E001002" + App.GStrSpliterChar; TextBoxServerPort.Focus(); return(LBoolReturn); } LStrLoginName = ComboBoxLoginName.Text.Trim(); if (string.IsNullOrEmpty(LStrLoginName)) { AStrReturn = "E001003" + App.GStrSpliterChar; ComboBoxLoginName.Focus(); return(LBoolReturn); } LStrLoginPassword = PasswordBoxLoginPassword.Password; if (string.IsNullOrEmpty(LStrLoginPassword)) { AStrReturn = "E001004" + App.GStrSpliterChar; PasswordBoxLoginPassword.Focus(); return(LBoolReturn); } if (CheckBoxRemberPassword.IsChecked == true) { LStrRememberPassword = "******"; } IListConnectInfo.Add(LStrServerName); //0 IListConnectInfo.Add(LIntServerPort.ToString()); //1 IListConnectInfo.Add(LStrLoginName); //2 IListConnectInfo.Add(LStrLoginPassword); //3 IListConnectInfo.Add(LStrRememberPassword); //4 IListConnectInfo.Add(LIntNetworkProtocolIndex.ToString()); //5 IListConnectInfo.Add(LStrNetworkProtocol); //6 IListConnectInfo.Add(LIntConnectionTimeOut.ToString()); //7 IListConnectInfo.Add(LIntExcutionTimeOut.ToString()); //8 IListConnectInfo.Add("F"); //9首次连接服务器 IListConnectInfo.Add(""); //10登录流水号 IListConnectInfo.Add(""); //11用户19位编码 LBoolReturn = true; } catch (Exception ex) { LBoolReturn = false; AStrReturn = "E001999" + App.GStrSpliterChar + ex.Message; } return(LBoolReturn); }