public JXManager() { JXManagerInstance = this; InitializeComponent(); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(pwd.Password)) { MessageBoxEx.Show(this, PRO_ReceiptsInvMgr.Resources.Message.PwdNotEmpty, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } var deviceId = BoxInfoHelper.GetDeviceNo(); if (string.IsNullOrEmpty(deviceId)) { MessageBoxEx.Show(this, PRO_ReceiptsInvMgr.Resources.Message.GetDeviceNoError, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } var isSuccess = false; string getDqdmError = string.Empty; this.Dispatcher.Invoke(new Action(() => { WaitingBox.Show(() => { string netLocation = service.GetNetLocation(GlobalInfo.Dqdm); if (!string.IsNullOrEmpty(netLocation)) { CryptTool.LoginUrl = netLocation + ConfigHelper.GetAppSettingValue("JXLoginUri"); CryptTool.QueryUrl = netLocation + ConfigHelper.GetAppSettingValue("JXQueryUri"); } if (!string.IsNullOrEmpty(getDqdmError)) { return; } var loop = 0; while ((loop < 5 && !string.IsNullOrEmpty(CryptTool.ErrorMsg) && CryptTool.ErrorMsg.Contains(PRO_ReceiptsInvMgr.Resources.Message.JXCertError)) || loop == 0) { isSuccess = CryptTool.Login(pwd.Password); GlobalInfo.NSRMC = CryptTool.Nsrmc; loop++; if (isSuccess) { break; } } }, PRO_ReceiptsInvMgr.Resources.Message.loginWait); })); if (!string.IsNullOrEmpty(getDqdmError)) { MessageBoxEx.Show(this, getDqdmError, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); return; } else { Logging.Log4NetHelper.Info(this, "地区代码:" + GlobalInfo.Dqdm); } if (!isSuccess) { MessageBoxEx.Show(this, CryptTool.ErrorMsg, PRO_ReceiptsInvMgr.Resources.Message.Tips, MessageBoxExButtons.OK, MessageBoxExIcon.Error); } else { GlobalInfo.JxPwd = pwd.Password; GlobalInfo.token = CryptTool.Token; JXManager win = new JXManager(); win.Show(); isBack = false; this.Close(); } }
private void BaseWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { JXManagerInstance = null; MainWindow.GetMainWindowInstance.NotifyMenuItemRestore_Click(null, null); }