Пример #1
0
 public virtual void AddChild(MenuItemButton <TData> childControl)
 {
     _subMenuItems.Add(childControl);
     childControl.Parent = this;
     //ScoreboardContext.CurrentState.AddToControlList(childControl);
     //childControl.CompositionLevel = CompositionLevel + 1;
 }
Пример #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);
         }
     }
 }
Пример #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);
     }
 }
Пример #4
0
 public virtual void Press(MenuItemButton <object> sender, KeyPressEventArgs e)
 {
     OnPressed(sender, e);
 }