private void Application_Exit(object sender, ExitEventArgs e) { CFGUtils.SaveConfig("ADPORT", Global.strADPORT); CFGUtils.SaveConfig("SXT1PORT", Global.strSXT1PORT); CFGUtils.SaveConfig("SXT2PORT", Global.strSXT2PORT); CFGUtils.SaveConfig("SXT3PORT", Global.strSXT3PORT); CFGUtils.SaveConfig("SXT4PORT", Global.strSXT4PORT); CFGUtils.SaveConfig("PRINTPORT", Global.strPRINTPORT); CFGUtils.SaveConfig("HMPORT", Global.strHMPORT); CFGUtils.SaveConfig("WSWPATH", Global.strWSWPATH); CFGUtils.SaveConfig("GZZPATH", Global.strGZZPATH); CFGUtils.SaveConfig("HOLECOUNT", string.Empty + Global.deviceHole.HoleCount); CFGUtils.SaveConfig("SXTCOUNT", string.Empty + Global.deviceHole.SxtCount); CFGUtils.SaveConfig("HMCOUNT", string.Empty + Global.deviceHole.HmCount); CFGUtils.SaveConfig("SERVERADDR", Global.strSERVERADDR); //CFGUtils.SaveConfig("SERVERADDR", textBoxServerAddr.Text); CFGUtils.SaveConfig("REGISTERID", Global.REGISTERID); //"cgqcheck"); CFGUtils.SaveConfig("REGISTERPASSWORD", Global.REGISTERPASSWORD); //"888888"); CFGUtils.SaveConfig("CHECKPOINTID", Global.CHECKPOINTID); //"001002001002"); CFGUtils.SaveConfig("CHECKPOINTNAME", Global.CHECKPOINTNAME); // "城关区食品药品监督管理局检测中心"); CFGUtils.SaveConfig("CHECKPOINTTYPE", Global.CHECKPOINTTYPE); // "检测中心"); CFGUtils.SaveConfig("ORGANIZATION", Global.ORGANIZATION); #region // 如果读取项目出错,然后退出程序的时候,又保存,那么这些项目就会没掉。 //Global.SerializeToFile( Global.deviceHole, Global.deviceHoleFile); //Global.SerializeToFile( Global.userAccounts, Global.userAccountsFile); //Global.SerializeToFile(Global.fgdItems, Global.fgdItemsFile); //Global.SerializeToFile(Global.gszItems, Global.gszItemsFile); //Global.SerializeToFile(Global.jtjItems, Global.jtjItemsFile); //Global.SerializeToFile(Global.hmItems, Global.hmItemsFile); #endregion Global.updateThread.Stop(); Global.workThread.Stop(); Global.printThread.Stop(); }
private void tb_save_Click(object sender, RoutedEventArgs e) { try { string str = tb_usr.Text.Trim(); if (str.Length == 0) { MessageBox.Show("账号信息不能为空!", "操作提示"); tb_usr.Focus(); return; } Wisdom.USER = str; str = tb_pwd.Text.Trim(); if (str.Length == 0) { MessageBox.Show("密码不能为空!", "操作提示"); tb_pwd.Focus(); return; } Wisdom.PASSWORD = str; CFGUtils.SaveConfig("USER", Wisdom.USER); CFGUtils.SaveConfig("PASSWORD", Wisdom.PASSWORD); MessageBox.Show("智慧食药监 - 账号信息设置成功!", "操作提示"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 进入登陆界面时初始化分光光度所有项目的对照值 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { if (Global.InterfaceType.Equals("ZH")) { if (Wisdom.DEVICESTATUS_REQUEST == null) { Wisdom.DEVICESTATUS_REQUEST = new DYSeriesDataSet.deviceStatus.Request(); } Wisdom.DEVICESTATUS_REQUEST.deviceStatus = "1"; UploadDeviceStatus(); } labelName.Content = Global.InstrumentNameModel + Global.InstrumentName; List <DYFGDItemPara> items = Global.fgdItems; if (items != null && items.Count > 0) { for (int i = 0; i < items.Count; i++) { items[i].sc.RefA = items[i].ir.RefDeltaA = Double.MinValue; } } new XmlSerialize().SerializeXMLToFile <List <DYFGDItemPara> >(items, Global.ItemsDirectory + "\\" + "fgdItems.xml"); if (Global.IsTest) { TextBoxUserName.Text = "260905"; TextBoxUserPassword.Password = "******"; } if (Global.KsVersion.Equals("0")) { lb_version.Content = "昆山专用(市场) Ver 2.4.3.180308"; } else if (Global.KsVersion.Equals("1")) { lb_version.Content = "昆山专用(超市) Ver 2.4.3.180308"; } else { lb_version.Content = "昆山专用(分局) Ver 2.4.3.180308"; } //是否需要更新数据库 if (!CFGUtils.GetConfig("DataBaseVersion", "0").Equals("3")) { UpgradeData(); CFGUtils.SaveConfig("DataBaseVersion", "3"); } }