private void metroButtonHkApply_Click(object sender, EventArgs e) { List <Hashtable> hkList = new List <Hashtable>(); Hashtable ht = new Hashtable(); ht.Add("key", "relogin"); ht.Add("value", TranslateHotKey(uteHkRelogin.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "lock"); ht.Add("value", TranslateHotKey(uteHkLock.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun1"); ht.Add("value", TranslateHotKey(uteHkFun1.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun2"); ht.Add("value", TranslateHotKey(uteHkFun2.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun3"); ht.Add("value", TranslateHotKey(uteHkFun3.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun4"); ht.Add("value", TranslateHotKey(uteHkFun4.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun5"); ht.Add("value", TranslateHotKey(uteHkFun5.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun6"); ht.Add("value", TranslateHotKey(uteHkFun6.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun7"); ht.Add("value", TranslateHotKey(uteHkFun7.Text)); hkList.Add(ht); ht = new Hashtable(); ht.Add("key", "fun8"); ht.Add("value", TranslateHotKey(uteHkFun8.Text)); hkList.Add(ht); settings["hotkey"] = JSONUtil.ToJson(hkList); BipConfig.StoreObject(Globals.SettingConfigName, settings); Globals.HotkeyList = hkList;//快捷键设置更改后立即更新 metroButtonHkApply.Enabled = false; }
private void metroButtonClearHis_Click(object sender, EventArgs e) { Hashtable htBase = JSONUtil.Parse <Hashtable>(settings["base"].ToString()); htBase["history"] = ""; settings["base"] = JSONUtil.ToJson(htBase); BipConfig.StoreObject(Globals.SettingConfigName, settings); metroButtonClearHis.Enabled = false; //MetroMessageBox.Show(this,"清空完成!"); }
private void metroButtonBaseApply_Click(object sender, EventArgs e) { Hashtable htBase = JSONUtil.Parse <Hashtable>(settings["base"].ToString()); htBase["hisFlag"] = metroToggleHisFlag.Checked ? "1" : "0"; htBase["hisNum"] = numericUpDownHisNum.Value; settings["base"] = JSONUtil.ToJson(htBase); BipConfig.StoreObject(Globals.SettingConfigName, settings); metroButtonBaseApply.Enabled = false; }
private new void Update() { isUpdating = true; if (updateVersionList.Count > 0) { int step = updateVersionList.Count; int i = 0; foreach (FileVersion fileVersion in updateVersionList) { com.ccf.bip.framework.server.file.FileInfo fileInfo = this.FindOne <com.ccf.bip.framework.server.file.FileInfo>(Globals.PROGRAM_UPDATE_SERVICE_NAME, "download", new object[] { fileVersion.GetFullName() }); //无法从服务器获取文件时忽略该文件更新,下次重新更新 if (fileInfo == null) { FileVersion tempVersion = remoteVersionList.Find(r => r.GetFullName().Equals(fileVersion.GetFullName())); if (tempVersion != null) { if (tempVersion.Version > 1) { tempVersion.Version = tempVersion.Version - 1; } else { remoteVersionList.Remove(tempVersion); } } continue; } string fullName = Globals.AppPath + Path.DirectorySeparatorChar.ToString() + fileVersion.GetFullName(); string fullPath = Globals.AppPath + Path.DirectorySeparatorChar.ToString() + fileVersion.Directory; if (!Directory.Exists(fullPath)) { Directory.CreateDirectory(fullPath); } else { if (File.Exists(fullName)) { File.Delete(fullName); } } File.WriteAllBytes(fullName, fileInfo.Content); Invoke(new ShowDelegete(UpdateProgressValue), new object[] { (++i) * 100 / step < 100 ? i * 100 / step : 100 }); Thread.Sleep(1000); //progressBar1.Value = (++i) * 100 / step < 100 ? i * 100 / step : 100; } //update version BipConfig.StoreObject(Globals.FileVersionConfigName, remoteVersionList); } isUpdating = false; //run bip Invoke(new UpdateDelegate(RunBip)); }
/// <summary> /// 打开业务功能界面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mainMenuTree_OnBipFormOpenning(object sender, OpenFormEventArgs e) { bool isOpenBipForm = false; SysFunction function = e.Fucntion; string formId; foreach (Form mdiChild in this.MdiChildren) { if (mdiChild.GetType().IsSubclassOf(typeof(BipForm))) { formId = (mdiChild as BipForm).Id; if (formId.Equals(function.FunctionId)) { mdiChild.Activate(); isOpenBipForm = true; break; } } } Assembly bipFormAssembly = Assembly.Load(function.Assemblyname); Type type = bipFormAssembly.GetType(function.Url); if (!isOpenBipForm && type.IsSubclassOf(typeof(BipForm))) { BipForm form = Activator.CreateInstance(type, true) as BipForm; form.MdiParent = this; form.Id = function.FunctionId; form.Text = function.FunctionName; form.User = this.User; form.CustomInformation = function.Tag; //从树菜单根节点系统获取服务端URL UltraTreeNode node = mainMenuTree.GetNodeByKey(function.FunctionId); while (node.Parent != null) { node = node.Parent; } string url = (node.Tag as SysFunction).Url; //未配置系统后台服务Url则使用平台默认URL if (String.IsNullOrEmpty(url)) { url = Globals.ServerList.Find(s => s.Id == 0).Url; } form.Action = new BipAction(url); //ultraTabbedMdiManager1.TabFromForm(form).Settings.TabCloseAction = Infragistics.Win.UltraWinTabbedMdi.MdiTabCloseAction.None;//不允许关闭界面 BipStyleBuilder.SetFormStyle(form);//设置样式 //设置界面toolbar及功能按钮 List <SysFunction> buttonList = new List <SysFunction>(); buttonList.AddRange(this.Find <SysFunction>("com.ccf.bip.biz.system.authorization.service.FunctionService", "findButtonList", new object[] { form.Id })); GenerateUltraToolBar(form, buttonList); form.Show(); isOpenBipForm = true; //使用快捷键 if (function.UseHotKey) { form.KeyPreview = true; form.KeyDown += new KeyEventHandler(form_KeyDown); } } if (isOpenBipForm) { //记录界面打开记录 //读取本地配置文件 Hashtable htSettings = BipConfig.LoadObject <Hashtable>("setting.bip"); string baseSettinStr = htSettings["base"].ToString(); Hashtable htBase = JSONUtil.Parse <Hashtable>(baseSettinStr); bool hisFlag = htBase["hisFlag"].ToString().Equals("1"); Decimal hisNum = Convert.ToDecimal(htBase["hisNum"].ToString()); List <Hashtable> listHis = JSONUtil.Parse <List <Hashtable> >(htBase["history"].ToString()); if (hisFlag) { if (listHis == null) { listHis = new List <Hashtable>(); } Hashtable swapHt = null; foreach (Hashtable h in listHis) { if (h["formId"].ToString().Equals(function.FunctionId)) { swapHt = h; break; } } if (swapHt != null) { listHis.Remove(swapHt); listHis.Insert(0, swapHt); } else { Hashtable ht = new Hashtable(); ht["formId"] = function.FunctionId; ht["formName"] = function.FunctionName; listHis.Insert(0, ht); } while (listHis.Count > hisNum) { listHis.RemoveAt(listHis.Count - 1); } htBase["history"] = JSONUtil.ToJson(listHis); htSettings["base"] = JSONUtil.ToJson(htBase); BipConfig.StoreObject("setting.bip", htSettings); } } }