Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="el"></param>
 /// <returns></returns>
 public override AppMenu Setup(XElement el)
 {
     ApplyAttributes(el);
     this.Items = new Dictionary <string, AppMenuItem>();
     if (el.HasElements)
     {
         foreach (var item in el.Elements())
         {
             var newmenuitem = new AppMenuItem().Setup(item, null, this);
             this.Items.Add(newmenuitem.Code, newmenuitem);
         }
     }
     return(this);
 }
Пример #2
0
        private AppMenuItem GetItemByCode(IDictionary <string, AppMenuItem> items, string code)
        {
            AppMenuItem result = null;

            if (items.ContainsKey(code))
            {
                result = items[code];
            }
            else
            {
                foreach (var item in items)
                {
                    if (null != result)
                    {
                        continue;
                    }
                    result = GetItemByCode(item.Value.Items, code);
                }
            }
            return(result);
        }