Ejemplo n.º 1
0
        /// <summary>Removes the given item from the menu.</summary>
        /// <param name="item">The item to remove.</param>
        /// <returns>True if the item could be removed</returns>
        public bool Remove(PrintableItem item)
        {
            if (item.Parent == root)
            {
                item.Parent = null;
                item.Menu   = null;
            }

            return(root.Items.Remove(item));
        }
Ejemplo n.º 2
0
        public void Add(PrintableItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (SelectedItem == null)
            {
                selectedItem = item as ConsoleMenuItem;
            }

            item.Parent = root;
            item.Menu   = this;
            root.Items.Add(item);
        }