private Task OpenCommandBox(string obj) { var cb = new CommandBox(); cb.Location = new Point(Location.X + (Size.Width - cb.Width) / 2, Location.Y + (Size.Height - cb.Height) / 4); cb.StartPosition = FormStartPosition.Manual; cb.Show(this); return(Task.CompletedTask); }
public CommandItem(IActivator activator, CommandBox owner) { Activator = activator; _owner = owner; _active = false; Anchor = AnchorStyles.Left | AnchorStyles.Right; Height = 25; BackColor = ButtonBackColour; Padding = new Padding(1); Margin = Padding.Empty; _label = new Label { Text = activator.Name, Dock = DockStyle.Fill, BackColor = ButtonBackColour, TextAlign = ContentAlignment.MiddleLeft }; Controls.Add(_label); _label.MouseEnter += (s, e) => { _owner.SetActiveComponent(this); }; _label.Click += async(s, e) => { await _owner.Activate(Activator); }; }