/// <summary>
        /// 删除菜单实例,回写数据库
        /// </summary>
        /// <param name="keyId"></param>
        public void DeleteMenuInstances(int keyId)
        {
            if (DicInstances.ContainsKey(keyId))
            {
                DicInstances.Remove(keyId);

                var args = new PublishEventArgs()
                {
                    EventId =
                        EventIdAssign.
                        MenuInstanceUpdate,
                    EventType = PublishEventType.Core
                };
                args.AddParams(keyId);
                EventPublish.PublishEvent(args);
                WriteDeleteDbByPrivate(keyId);
            }
        }
        /// <summary>
        /// 更新菜单实例 无则增加,回写数据库
        /// </summary>
        /// <param name="keyId">唯一标示</param>
        /// <param name="name"></param>
        /// <param name="keyMenu"></param>
        /// <param name="idClassic"></param>
        public void UpdateMenuInstances(int keyId, string name, string keyMenu, int idClassic)
        {
            if (keyId >= MenuIdControlAssign.MenuInstanceKeyIdMin &&
                keyId <= MenuIdControlAssign.MenuInstancesKeyIdMax)
            {
            }
            else
            {
                return;
            }
            if (!DicInstances.ContainsKey(keyId))
            {
                DicInstances.Add(keyId,
                                 new MenuInstance()
                {
                    Id        = keyId,
                    IdClassic = idClassic,
                    Key       = keyMenu,
                    Name      = name
                });
            }
            else
            {
                DicInstances[keyId].Id        = keyId;
                DicInstances[keyId].IdClassic = idClassic;
                DicInstances[keyId].Key       = keyMenu;
                DicInstances[keyId].Name      = name;
            }
            WriteUpdateDbByPrivate(keyId);

            var args = new PublishEventArgs()
            {
                EventId =
                    EventIdAssign.
                    MenuInstanceUpdate,
                EventType = PublishEventType.Core
            };

            args.AddParams(keyId);
            EventPublish.PublishEvent(args);
        }
        private void WriteUpdateDbByPrivate(int id)
        {
            SqlLiteHelper.ExecuteNonQuery("delete from menu_instances where id=" + id);
            if (!DicInstances.ContainsKey(id))
            {
                return;
            }
            var    t = DicInstances[id];
            string strUpdateDirectroy = "insert into menu_instances(id,name,key,id_classic) values";

            strUpdateDirectroy += "(" + t.Id + ",'" + t.Name + "','" + t.Key + "'," + t.IdClassic +
                                  ")";
            try
            {
                SqlLiteHelper.ExecuteNonQueryInThread(strUpdateDirectroy);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
 /// <summary>
 /// 增加菜单实例
 /// </summary>
 /// <param name="keyId">唯一地址</param>
 /// <param name="name">名称</param>
 /// <param name="keyMenu"></param>
 /// <param name="idClassic"></param>
 private void AddMenuInstances(int keyId, string name, string keyMenu, int idClassic)
 {
     if (!DicInstances.ContainsKey(keyId))
     {
         DicInstances.Add(keyId,
                          new MenuInstance()
         {
             Id        = keyId,
             IdClassic = idClassic,
             Key       = keyMenu,
             Name      = name
         });
     }
     else
     {
         DicInstances[keyId].Id        = keyId;
         DicInstances[keyId].IdClassic = idClassic;
         DicInstances[keyId].Key       = keyMenu;
         DicInstances[keyId].Name      = name;
     }
 }