Example #1
0
 public virtual void AddChild(MenuItemButton <TData> childControl)
 {
     _subMenuItems.Add(childControl);
     childControl.Parent = this;
     //ScoreboardContext.CurrentState.AddToControlList(childControl);
     //childControl.CompositionLevel = CompositionLevel + 1;
 }
Example #2
0
 protected virtual void ClearInternal(MenuItemButton <object> menuItem)
 {
     if (menuItem.SubMenuItems != null && menuItem.SubMenuItems.Any())
     {
         foreach (var subMenu in menuItem.SubMenuItems)
         {
             subMenu.KeyPress -= Button_KeyPress;
             ClearInternal(subMenu);
             RemoveChild(subMenu);
         }
     }
 }
Example #3
0
 protected virtual void OnPressed(MenuItemButton <object> sender, KeyPressEventArgs e)
 {
     if (sender.SubMenuItems != null && sender.SubMenuItems.Any())
     {
         MessageBox.MessageBox.Show("Select option",
                                    sender.SubMenuItems.Select(i => new SubmenuContext <object>()
         {
             Data      = i.Data,
             Text      = i.Text,
             IsEnabled = i.IsEnabled
         }), (e1, data) =>
         {
             Pressed?.Invoke(sender, data);
         }, sender.Text, MessageBoxTypeEnum.None,
                                    MessageBoxButtonsDirectionEnum.Vertical);
     }
     else
     {
         Pressed?.Invoke(sender, sender.Data);
     }
 }
Example #4
0
 public virtual void Press(MenuItemButton <object> sender, KeyPressEventArgs e)
 {
     OnPressed(sender, e);
 }