/// <summary> /// 初始化界面元素 /// </summary> public void InitControl() { spDisplayContent.Children.Clear(); spTipContent.Children.Clear(); lblMessageID.Content = string.Empty; lblModuleID.Content = string.Empty; lblChildModuleID.Content = string.Empty; lblInPageFrame.Content = string.Empty; if (lstLanguageInfos.Count <= 0) { return; } lblMessageID.Content = lstLanguageInfos[0].MessageID; lblModuleID.Content = lstLanguageInfos[0].ModuleID; lblChildModuleID.Content = lstLanguageInfos[0].ChildModuleID; lblInPageFrame.Content = lstLanguageInfos[0].InFrame; StackPanel spDisplay; Label lblLanguageCode; TextBlock txtDisplay; for (int i = 0; i < lstLanguageInfos.Count; i++) { lblLanguageCode = new Label(); lblLanguageCode.Content = ServerConfigOperationInServer.GetLanguageItemInDBByMessageID(App.GCurrentUmpServer , App.GCurrentDBServer, lstLanguageInfos[i].LanguageCode, lstLanguageInfos[i].LanguageCode); lblLanguageCode.Margin = new Thickness(10); txtDisplay = new TextBlock(); txtDisplay.Tag = lstLanguageInfos[i].LanguageCode; txtDisplay.Background = Brushes.Transparent; txtDisplay.TextWrapping = TextWrapping.Wrap; txtDisplay.Text = lstLanguageInfos[i].DisplayMessage; txtDisplay.Margin = new Thickness(30, 0, 10, 0); spDisplay = new StackPanel(); spDisplay.Children.Add(lblLanguageCode); spDisplay.Children.Add(txtDisplay); spDisplayContent.Children.Add(spDisplay); } StackPanel spTip; TextBlock txtTip; for (int i = 0; i < lstLanguageInfos.Count; i++) { lblLanguageCode = new Label(); lblLanguageCode.Content = ServerConfigOperationInServer.GetLanguageItemInDBByMessageID(App.GCurrentUmpServer , App.GCurrentDBServer, lstLanguageInfos[i].LanguageCode, lstLanguageInfos[i].LanguageCode); lblLanguageCode.Margin = new Thickness(10); txtTip = new TextBlock(); txtTip.Tag = lstLanguageInfos[i].LanguageCode; txtTip.Background = Brushes.Transparent; txtTip.TextWrapping = TextWrapping.Wrap; txtTip.Text = lstLanguageInfos[i].TipMessage; txtTip.Margin = new Thickness(30, 0, 10, 0); spTip = new StackPanel(); spTip.Children.Add(lblLanguageCode); spTip.Children.Add(txtTip); spTipContent.Children.Add(spTip); } }
void LoginWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { DBInfo db = null; if (lstDBsInUmp.Count > 0) { db = lstDBsInUmp[0]; } else { //如果未找到数据库配置 则返回 MessageBox.Show(this.TryFindResource("Error013").ToString(), this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error); return; } string strMessage = string.Empty; if (LoginResult != null) { if (!LoginResult.BoolReturn) { strMessage = ServerConfigOperationInServer.GetLanguageItemInDBByMessageID(App.GCurrentUmpServer, db, "S0000028", App.GStrCurrentLanguage); MessageBox.Show(strMessage, this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error); return; } List <string> lstLoginReturn = LoginResult.StringReturn.Split(App.GStrSpliterCharater.ToCharArray()).ToList(); //将收到的消息解密 string LStrVerificationCode104 = Common.CreateVerificationCode(PFShareClassesC.EncryptionAndDecryption.UMPKeyAndIVType.M104); for (int i = 0; i < lstLoginReturn.Count; i++) { lstLoginReturn[i] = EncryptionAndDecryption.EncryptDecryptString(lstLoginReturn[i], LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104); } if (lstLoginReturn[0].StartsWith("S")) { App.GLstConnectedServers.Add(App.GCurrentUmpServer); App.GCurrentUser.TenantID = lstLoginReturn[1]; App.GCurrentUser.UserID = lstLoginReturn[2]; App.GCurrentUser.SessionID = lstLoginReturn[3]; App.GCurrentUser.UserName = lstLoginReturn[4]; MainWin main = new MainWin(); main.Show(); this.Close(); return; } switch (lstLoginReturn[0]) { //case "S01A00": // // UserLoginReturnS01A01(LStrLoginReturn); //break; case "E01A32": strMessage = ServerConfigOperationInServer.GetLanguageItemInDBByObjectIDAndPage(App.GCurrentUmpServer, db, lstLoginReturn[0], App.GStrCurrentLanguage, "Page00000A"); strMessage = string.Format(strMessage, DateTime.Parse(lstLoginReturn[1]).ToLocalTime().ToString("G"), lstLoginReturn[2], lstLoginReturn[3]); MessageBox.Show(strMessage, this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error); break; case "E01A99": strMessage = ServerConfigOperationInServer.GetLanguageItemInDBByMessageID(App.GCurrentUmpServer, db, "S0000028", App.GStrCurrentLanguage); MessageBox.Show(strMessage, this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error); break; default: strMessage = ServerConfigOperationInServer.GetLanguageItemInDBByMessageID(App.GCurrentUmpServer, db, "S0000029", App.GStrCurrentLanguage); strMessage += "\n\n"; strMessage += ServerConfigOperationInServer.GetLanguageItemInDBByObjectIDAndPage(App.GCurrentUmpServer, db, lstLoginReturn[0], App.GStrCurrentLanguage, "Page00000A"); MessageBox.Show(strMessage, this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Warning); break; } //if (lstLoginReturn[0].StartsWith("S")) //{ // MainWin main = new MainWin(); // main.Show(); // this.Close(); //} //else //{ // MessageBox.Show(strMessage, this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error); //} } }