//窗体加载 private void MainForm_Load(object sender, EventArgs e) { Form.CheckForIllegalCrossThreadCalls = false; try { Config.Machine = Share.DESForm(ConfigurationManager.AppSettings["Machine"]); Config.acceptOrderInterfaceUrl = ConfigurationManager.AppSettings["acceptOrderInterfaceUrl"]; Config.url = ConfigurationManager.AppSettings["url"]; Config.venderId = ConfigurationManager.AppSettings["venderId"]; Config.notifyUrl = ConfigurationManager.AppSettings["notifyUrl"]; Config.md5Key = Share.DESForm(ConfigurationManager.AppSettings["md5Key"]); webBrowserLogin.ScriptErrorsSuppressed = true; this.webBrowserLogin.Navigate(Config.url); View.write("程序初始化完成"); } catch (Exception ex) { MessageBox.Show("检查到参数信息未设置或设置错误,请重新设置!"); FormSet frm = new FormSet(); frm.ShowDialog(); MessageBox.Show("您重新设置了参数信息,重新打开软件使配置生效!"); this.Close(); return; } }
private void FormSet_Load(object sender, EventArgs e) { //初始加载 this.tbxUrl.Text = ConfigurationManager.AppSettings["url"].Trim(); this.tbxAcceptOrderInterfaceUrl.Text = ConfigurationManager.AppSettings["acceptOrderInterfaceUrl"].Trim(); this.tbxVenderId.Text = ConfigurationManager.AppSettings["venderId"].Trim(); this.tbxNotifyUrl.Text = ConfigurationManager.AppSettings["notifyUrl"].Trim(); try { if (ConfigurationManager.AppSettings["Machine"].Trim() != "") { tbxMachine.Text = Share.DESForm(ConfigurationManager.AppSettings["Machine"]); } } catch (Exception ex) { tbxMachine.Text = ""; } try { if (ConfigurationManager.AppSettings["md5Key"].Trim() != "") { tbxMd5Key.Text = Share.DESForm(ConfigurationManager.AppSettings["md5Key"]); } } catch (Exception ex) { tbxMd5Key.Text = ""; } }