Example #1
0
        MenuItem AddMenuItem(ItemCollection items, string header, MyMenuInfo menuInfo)
        {
            var menuItem = menuInfo.CreateMenuItem(header);
            items.Add(menuItem);

            return menuItem;
        }
Example #2
0
        void Add(ItemCollection items, MyMenuInfo menuInfo, Stack<string> headers)
        {
            var header = headers.Pop();

            if (headers.Count == 0)
            {
                AddMenuItem(items, header, menuInfo);
            }
            else
            {
                var menuItem = Find(items, header);

                if (menuItem == null)
                    menuItem = AddMenuItem(items, header, MyMenuInfo.Empty());

                Add(menuItem.Items, menuInfo, headers);
            }
        }
Example #3
0
        public void Add(MyMenuInfo menuInfo, params string[] menuHeaders)
        {
            var headerStack = new Stack<string>(menuHeaders.Reverse());

            Add(_menu.Items, menuInfo, headerStack);
        }