コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// 增加快捷键信息
 /// </summary>
 /// <param name="menuId">菜单部件唯一地址</param>
 /// <param name="shortcut">名称</param>
 public void AddShortCut(int menuId, string shortcut)
 {
     if (string.IsNullOrEmpty(shortcut))
     {
         return;
     }
     if (!DicClassic.ContainsKey(menuId))
     {
         DicClassic.Add(menuId, shortcut);
     }
     else
     {
         DicClassic[menuId] = shortcut;
     }
 }
コード例 #3
0
        /// <summary>
        /// 更新模板菜单 无则增加,并回写数据库
        /// </summary>
        /// <param name="keyId">唯一标示</param>
        /// <param name="name">模板菜单名称</param>
        /// <param name="content">模板菜单包含的菜单集合  以#分割开</param>
        private void UpdateMneu(int keyId, string name, string content)
        {
            if (MenuIdControlAssign.MenuClassicIdMin <= keyId && keyId <= MenuIdControlAssign.MenuClassicIdMax)
            {
            }
            else
            {
                return;
            }
            if (!DicClassic.ContainsKey(keyId))
            {
                DicClassic.Add(keyId, new MenuClassic()
                {
                    Id = keyId, Name = name
                });
            }
            DicClassic[keyId].Name = name;

            string[] sp = content.Split('#');
            foreach (var t in sp)
            {
                if (string.IsNullOrEmpty(t))
                {
                    continue;
                }
                try
                {
                    int x = Convert.ToInt32(t);
                    if (x > 0)
                    {
                        if (!DicClassic[keyId].Items.Contains(x))
                        {
                            DicClassic[keyId].Items.Add(x);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Wlst.Cr.Core.UtilityFunction.WriteLog.WriteLogError("Error:" + ex);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// 更新模板菜单 无则增加,并回写数据库
        /// </summary>
        /// <param name="keyId">唯一标示</param>
        /// <param name="name">模板菜单名称</param>
        /// <param name="content">模板菜单包含的菜单集合</param>
        public void UpdateMneu(int keyId, string name, List <int> content)
        {
            if (MenuIdControlAssign.MenuClassicIdMin <= keyId && keyId <= MenuIdControlAssign.MenuClassicIdMax)
            {
            }
            else
            {
                return;
            }
            if (!DicClassic.ContainsKey(keyId))
            {
                DicClassic.Add(keyId, new MenuClassic()
                {
                    Id = keyId, Name = name
                });
            }
            DicClassic[keyId].Name = name;

            DicClassic[keyId].Items.Clear();
            foreach (var t in content)
            {
                if (!DicClassic[keyId].Items.Contains(t))
                {
                    DicClassic[keyId].Items.Add(t);
                }
            }
            this.WriteUpdateDbByPrivate(keyId);
            var args = new PublishEventArgs()
            {
                EventId =
                    EventIdAssign.ClassicMenuUpdate,
                EventType = PublishEventType.Core
            };

            args.AddParams(keyId);
            EventPublish.PublishEvent(args);
        }