private void ReadConfig() { List <ServerConfig> list = BipConfig.Load <ServerConfig>(Globals.ServerConfigName); ServerConfig defaultServer = list.Find(s => s.Id == 0); this.Action = new BipAction(); Action.Url = defaultServer.Url; }
private void FormUpdate_Load(object sender, EventArgs e) { ReadConfig(); //find new version updateVersionList = new List <FileVersion>(); List <FileVersion> localVersionList = null; try { localVersionList = BipConfig.Load <FileVersion>(Globals.FileVersionConfigName); } catch (Exception ex) { } remoteVersionList = this.FindList <FileVersion>(Globals.PROGRAM_UPDATE_SERVICE_NAME, "findFileVersionList", new object[0]); //update program if (remoteVersionList != null) { if (localVersionList == null) { localVersionList = new List <FileVersion>(); } //排除文件路径、文件名相同且版本号小于等于当前版本的文件 updateVersionList.AddRange(remoteVersionList.Except <FileVersion>(localVersionList, new FileVersionCompare())); } if (updateVersionList.Count > 0) { //检测主程序是否已经运行 Process[] processesUI = Process.GetProcessesByName("BIP"); if (processesUI.Length > 0) { if (MetroMessageBox.Show(this, "系统有更新,是否关闭所有客户端进行更新?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { foreach (Process process in processesUI) { process.Kill(); } } else { RunBip(); } } } else { RunBip(); } updateThread = new Thread(new ThreadStart(Update)); updateThread.Start(); }
private void ParseSettings() { if (settings != null && settings.Count > 0) { string baseSettinStr = settings["base"].ToString(); Hashtable htBase = JSONUtil.Parse <Hashtable>(baseSettinStr); metroToggleHisFlag.Checked = htBase["hisFlag"].ToString().Equals("1"); numericUpDownHisNum.Enabled = metroToggleHisFlag.Checked; numericUpDownHisNum.Value = Convert.ToDecimal(htBase["hisNum"].ToString()); metroButtonClearHis.Enabled = metroToggleHisFlag.Checked && numericUpDownHisNum.Value > 0; metroToggleHisFlag.CheckedChanged += new EventHandler(metroToggleHisFlag_CheckedChanged); numericUpDownHisNum.ValueChanged += new EventHandler(numericUpDownHisNum_ValueChanged); List <ServerConfig> srvList = BipConfig.Load <ServerConfig>(Globals.ServerConfigName); ServerConfig defaultServer = srvList.Find(s => s.Id == 0); String[] srvAddrs = defaultServer.Url.Split(new char[] { '/' }); String[] ip_port = srvAddrs[2].Split(new char[] { ':' }); String[] ips = ip_port[0].Split(new char[] { '.' }); ultraTextEditor16.Text = ips[0]; ultraTextEditor17.Text = ips[1]; ultraTextEditor18.Text = ips[2]; ultraTextEditor19.Text = ips[3]; ultraTextEditor20.Text = ip_port[1]; ultraTextEditor1.Text = srvAddrs[3]; metroButtonSrvApply.Enabled = false; string hotkeyStr = settings["hotkey"].ToString(); List <Hashtable> hotkeyList = JSONUtil.Parse <List <Hashtable> >(hotkeyStr); UltraTextEditor textEditor = null; foreach (Hashtable ht in hotkeyList) { switch (ht["key"].ToString()) { case "relogin": textEditor = uteHkRelogin; break; case "lock": textEditor = uteHkLock; break; case "fun1": textEditor = uteHkFun1; break; case "fun2": textEditor = uteHkFun2; break; case "fun3": textEditor = uteHkFun3; break; case "fun4": textEditor = uteHkFun4; break; case "fun5": textEditor = uteHkFun5; break; case "fun6": textEditor = uteHkFun6; break; case "fun7": textEditor = uteHkFun7; break; case "fun8": textEditor = uteHkFun8; break; } if (textEditor != null) { char[] htValues = ht["value"].ToString().ToCharArray(); textEditor.Value = ((htValues[0] == '1') ? "Ctrl + " : "") + ((htValues[1] == '1') ? "Shift + " : "") + ((htValues[2] == '1') ? "Alt + " : "") + htValues[3].ToString().ToUpper(); } } metroButtonHkApply.Enabled = false; ultraTextEditor12.Text = user.Employee.EmployeeName; //BipRow row = new BipRow(); //row.IsHeader = true; //row.Add(new BipCell() { Text = "系统名称", Width = 100 }); //row.Add(new BipCell() { Text = "服务器" }); //row.Add(new BipCell() { Text = "应用服务" }); //row.Add(new BipCell() { Text = "数据库" }); //bipTableView1.AddRow(row); //bipTableView1.Padding = new Padding(20, 10, 20, 10); } }