/// <summary> /// 更新快捷键信息,立即回写数据库并发布事件 /// </summary> /// <param name="menuId">菜单部件唯一标示</param> /// <param name="shortcut"></param> public void UpdateShortCut(int menuId, string shortcut) { if (string.IsNullOrEmpty(shortcut)) { if (DicClassic.ContainsKey(menuId)) { DicClassic.Remove(menuId); } } else { if (!DicClassic.ContainsKey(menuId)) { DicClassic.Add(menuId, shortcut); } else { DicClassic[menuId] = shortcut; } } var args = new PublishEventArgs() { EventType = PublishEventType.Core, EventId = EventIdAssign.MenuShourtCutsUpdate, }; args.AddParams(menuId); EventPublish.PublishEvent(args); this.WriteUpdateDbByPrivate(menuId); }
/// <summary> /// 删除快捷键信息,立即回写数据库并发布事件 /// </summary> /// <param name="menuId"></param> public void DeleteShortCut(int menuId) { if (DicClassic.ContainsKey(menuId)) { DicClassic.Remove(menuId); var args = new PublishEventArgs() { EventType = PublishEventType.Core, EventId = EventIdAssign.MenuShourtCutsUpdate, }; args.AddParams(menuId); EventPublish.PublishEvent(args); this.WriteDeleteDbByPrivate(menuId); } }
/// <summary> /// 删除模板菜单,并删除数据库中保留的模板菜单 /// </summary> /// <param name="keyId"></param> public void DeleteMneu(int keyId) { if (DicClassic.ContainsKey(keyId)) { DicClassic.Remove(keyId); WriteDeleteDbByPrivate(keyId); var args = new PublishEventArgs() { EventId = EventIdAssign.ClassicMenuUpdate, EventType = PublishEventType.Core }; args.AddParams(keyId); EventPublish.PublishEvent(args); } }