Exemplo n.º 1
0
        public Item Item(string text, Action action, Func <bool> enabled = null)
        {
            var b = Menu.CreateItemButton();

            Helper.DecorateButton(b, NiceColors.BasicColor(colorIndex));
            b.Id = Helper.TrimTextForId(text);
            var item = new Item(b)
            {
                Text    = text,
                Action  = action,
                Enabled = enabled ?? (() => true),
                Parent  = this
            };

            Menu.RegisterCheatButton(item.CheatIdText(), b);
            {
                b.Text = item.Text;
                Helper.UpdateButtonSizeConstraints(b);
            }
            b.Clicked = () => {
                item.Action();
                Menu.Hide();
            };
            b.Enabled = item.Enabled();
            ItemPanel.AddNode(b);
            return(item);
        }
Exemplo n.º 2
0
        public Section Section(string text)
        {
            var itemPanel = CreateItemPanel();
            var section   = new Section(this, itemPanel, nextColorIndex)
            {
                IdText = Helper.TrimTextForId(text)
            };
            var foldButton = CreateFoldButton(text);

            foldButton.Id = Helper.TrimTextForId(text);
            itemPanel.Id  = Helper.TrimTextForId(text);
            var arrow = foldButton["arrow"] as RichText;

            Helper.DecorateButton(foldButton, NiceColors.AccentColor(nextColorIndex), NiceColors.DarkTextColor(nextColorIndex));
            //(arrow.Nodes[0] as TextStyle).TextColor = NiceColors.DarkTextColor(nextColorIndex);
            section.Id         = AddNode(foldButton, itemPanel);
            foldButton.Clicked = () => { Fold(section.Id, !itemPanel.Visible); };
            listView.Content.AddNode(foldButton);
            listView.Content.AddNode(itemPanel);
            nextColorIndex++;
            return(section);
        }