Beispiel #1
0
        private void RegisterContainerActions(IActionContainer container)
        {
            bool isFirstMenuItem = true;

            foreach (ActionBase action in container.Actions)
            {
                action.Changed -= new EventHandler <ActionChangedEventArgs>(Action_Changed);
                action.Changed += new EventHandler <ActionChangedEventArgs>(Action_Changed);
                if (action.Active && action.Enabled)
                {
                    CustomCreateActionControlEventArgs customCreateActionControlEventArgs = new CustomCreateActionControlEventArgs(action, container);
                    if (CustomGenerateActionControl != null)
                    {
                        CustomGenerateActionControl(this, customCreateActionControlEventArgs);
                    }
                    if (!customCreateActionControlEventArgs.Handled)
                    {
                        MenuActionItemBase actionObject = GenerateactionObject(action);
                        actionObjects[action] = actionObject;
                        if (isFirstMenuItem)
                        {
                            actionObject.MenuItem.SlidingBeginGroup = true;
                            isFirstMenuItem = false;
                        }

                        MenuActionItemCreatedEventArgs args = new MenuActionItemCreatedEventArgs(actionObject);
                        OnMenuactionObjectCreated(args);
                    }
                }
            }
        }
Beispiel #2
0
 protected virtual void OnMenuactionObjectCreated(MenuActionItemCreatedEventArgs args)
 {
     if (MenuactionObjectCreated != null)
     {
         MenuactionObjectCreated(this, args);
     }
 }
        private void RegisterContainerActions(IActionContainer container)
        {
            bool isFirstMenuItem = true;
            foreach (ActionBase action in container.Actions)
            {
                action.Changed -= new EventHandler<ActionChangedEventArgs>(Action_Changed);
                action.Changed += new EventHandler<ActionChangedEventArgs>(Action_Changed);
                if (action.Active && action.Enabled)
                {
                    CustomCreateActionControlEventArgs customCreateActionControlEventArgs = new CustomCreateActionControlEventArgs(action, container);
                    if (CustomGenerateActionControl != null)
                    {
                        CustomGenerateActionControl(this, customCreateActionControlEventArgs);
                    }
                    if (!customCreateActionControlEventArgs.Handled)
                    {
                        MenuActionItemBase actionObject = GenerateactionObject(action);
                        actionObjects[action] = actionObject;
                        if (isFirstMenuItem)
                        {
                            actionObject.MenuItem.SlidingBeginGroup = true;
                            isFirstMenuItem = false;
                        }

                        MenuActionItemCreatedEventArgs args = new MenuActionItemCreatedEventArgs(actionObject);
                        OnMenuactionObjectCreated(args);
                    }
                }
            }
        }
 protected virtual void OnMenuactionObjectCreated(MenuActionItemCreatedEventArgs args)
 {
     if (MenuactionObjectCreated != null)
         MenuactionObjectCreated(this, args);
 }