예제 #1
0
        public static void PerformDefaultAction <T>(MenuItemsList <T> operations, T obj)
        {
            Action <T> action = operations.GetDefaultAction(obj);

            if (action != null)
            {
                action(obj);
            }
        }
예제 #2
0
        public static bool PerformActionByKey <T>(MenuItemsList <T> operations, MenuItemsList <T> shortcutOperations, Keys key, T obj)
        {
            Action <T> action = operations.GetActionByKey(key, obj);

            if (action != null)
            {
                action(obj);
                return(true);
            }
            action = shortcutOperations.GetActionByKey(key, obj);
            if (action != null)
            {
                action(obj);
                return(true);
            }
            return(false);
        }
예제 #3
0
 public void Add(string name, MenuItemsList <T> submenu)
 {
     Add(new SubMenuItem <T>(name, submenu));
 }
예제 #4
0
 public SubMenuItem(string text, MenuItemsList <T> list)
 {
     this.Text = text;
     this.List = list;
 }