Ejemplo n.º 1
0
        private void InitializeControls()
        {
            removeSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 16),
                Text     = "[R] Remove from Library"
            };
            removeSpellButton.Click += (sender, args) => RemoveSpell?.Invoke(this, EventArgs.Empty);
            Add(removeSpellButton);

            editSpellButton = new StandardButton(25)
            {
                Position = new Point(Width - 57, 13),
                Text     = "[E] Edit Spell"
            };
            editSpellButton.Click += (sender, args) => EditSpell?.Invoke(this, EventArgs.Empty);
            Add(editSpellButton);

            spellDetails = new SpellDetailsControl(57, Height - 10)
            {
                Position = new Point(Width - 58, 3)
            };
            Add(spellDetails);

            var scrollBarTheme = new ScrollBarTheme
            {
                Normal = new Cell(DefaultForeground, DefaultBackground)
            };
            var scrollBar = new ScrollBar(Orientation.Vertical, Height - 6)
            {
                Position = new Point(Width - 60, 5),
                Theme    = scrollBarTheme
            };

            Add(scrollBar);
            spellsList = new CustomListBox <SpellListBoxItem>(Width - 61, Height - 6, scrollBar)
            {
                Position = new Point(1, 5)
            };
            spellsList.SelectionChanged += spellsListBox_SelectedItemChanged;
            Add(spellsList);

            var textBoxTheme = new TextBoxTheme
            {
                Normal  = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)),
                Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255))
            };

            filterTextBox = new TextBox(Width - 69)
            {
                Position  = new Point(10, 3),
                Theme     = textBoxTheme,
                MaxLength = Width - 70
            };
            Add(filterTextBox);

            UpdateSpellDetails();
        }
Ejemplo n.º 2
0
        private void InitializeControls()
        {
            okButton = new StandardButton(20)
            {
                Position = new Point(3, Height - 4),
                Text     = "OK"
            };
            okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty);
            Add(okButton);

            cancelButton = new StandardButton(20)
            {
                Position = new Point(27, Height - 4),
                Text     = "Cancel"
            };
            cancelButton.Click += (sender, args) => Cancel?.Invoke(this, EventArgs.Empty);
            Add(cancelButton);

            launchEditorButton = new StandardButton(40)
            {
                Position = new Point(3, 12),
                Text     = "Launch Code Editor"
            };
            launchEditorButton.Click += (sender, args) => LaunchEditor?.Invoke(this, EventArgs.Empty);
            Add(launchEditorButton);

            var textBoxTheme = new TextBoxTheme
            {
                Normal  = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)),
                Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255))
            };

            spellNameTextBox = new TextBox(60)
            {
                Position  = new Point(3, 5),
                Theme     = textBoxTheme,
                MaxLength = 50
            };
            Add(spellNameTextBox);

            manaCostTextBox = new TextBox(15)
            {
                Position     = new Point(3, 8),
                IsNumeric    = true,
                AllowDecimal = false,
                Theme        = textBoxTheme,
                MaxLength    = 10
            };
            Add(manaCostTextBox);
        }