示例#1
0
 /// <summary>
 /// 添加子菜单
 /// </summary>
 /// <param name="item">子菜单</param>
 internal void AppendChild(SubMenu item)
 {
     if (item == null)
     {
         throw new ArgumentNullException(nameof(item));
     }
     if (this.m_children.Any(menu => menu.Id == item.Id))
     {
         throw new Code.Exception.CustomException("不能重复添加的同一子菜单");
     }
     this.m_children.Add(item);
 }
示例#2
0
        /// <summary>
        /// 克隆
        /// </summary>
        /// <returns>子菜单</returns>
        public SubMenu Clone()
        {
            var result = new SubMenu
            {
                Id          = this.Id,
                Title       = this.Title,
                Url         = this.Url,
                ParentId    = this.ParentId,
                Sort        = this.Sort,
                Description = this.Description,
                Icon        = this.Icon
            };

            foreach (var item in m_resources)
            {
                result.AppendResource(item.Clone());
            }
            return(result);
        }