/// <summary>
 /// Remove the TActionList
 /// </summary>
 /// <param name="actionList"></param>
 public void Remove(TActionList actionList)
 {
     if (actionList == null)
     {
         throw new ArgumentNullException(nameof(actionList));
     }
     for (int i = 0; i < _handlerList.Count; i++)
     {
         if (_handlerList[i].ActionList == actionList)
         {
             _handlerList.Remove(_handlerList[i]);
             break;
         }
     }
 }
            public Handler(TActionList actionList)
            {
                ActionList = actionList;
                _actionListWithShortCuts = new List <TAction>();
                ActionCollection col = actionList.Actions;

                for (int i = 0; i < col.Count; i++)
                {
                    TAction action = col[i];
                    if (action.ShortcutKeys != Keys.None)
                    {
                        _actionListWithShortCuts.Add(action);
                    }
                }
                ShortCutKeys = ShortCutKeysMethod;
            }
        /// <summary>
        /// Add a class (Control) with an TActionList and Shortcuts in TAction
        /// </summary>
        /// <param name="actionList"></param>
        public void Add(TActionList actionList)
        {
            if (actionList == null)
            {
                throw new ArgumentNullException(nameof(actionList));
            }
            for (int i = 0; i < _handlerList.Count; i++)
            {
                if (_handlerList[i].ActionList == actionList)
                {
                    return; //don't add the same actionList
                }
            }
            Handler handler = new Handler(actionList);

            _handlerList.Add(handler);
        }
Esempio n. 4
0
 /// <summary>
 ///  Initializes a new instance of ActionCollection.
 /// </summary>
 public ActionCollection(TActionList owner)
 {
     Debug.Assert(owner != null);
     _owner       = owner;
     _null._owner = _owner;
 }