예제 #1
0
        public CustomSplitButton CreateButton(string name, string text, Type externalCommandType, Action <CustomPushButton> action)
        {
            var button = new CustomPushButton(name, text, externalCommandType);

            action?.Invoke(button);
            Items.Add(button);
            return(this);
        }
        //Try add the "extension" method to add a separed button to the pulldown button
        public PushButton AddButton(Autodesk.Revit.UI.PulldownButton pulldownButton,
                                    string name,
                                    string text,
                                    Type externalCommandType,
                                    Action <CustomPushButton> action)
        {
            var button = new CustomPushButton(name,
                                              text,
                                              externalCommandType);

            action?.Invoke(button);
            return(pulldownButton.AddPushButton(button.GetItemData() as PushButtonData));
        }
예제 #3
0
        /// <summary>
        /// Create push button on the panel
        /// </summary>
        /// <param name="name">Internal name of the button</param>
        /// <param name="text">Text user will see</param>
        /// <param name="externalCommandType">Class which implements IExternalCommand interface.
        /// This command will be execute when user push the button</param>
        /// <param name="action">Additional action with whe button</param>
        /// <returns>Panel where button were created</returns>
        public CustomPanel CreateButton(string name,
                                        string text,
                                        Type externalCommandType,
                                        Action <CustomPushButton> action)
        {
            var button = new CustomPushButton(name,
                                              text,
                                              externalCommandType);

            action?.Invoke(button);
            var buttonData = button.GetButtonData();

            ConvertToPushButton = _panel.AddItem(buttonData) as PushButton;
            return(this);
        }
예제 #4
0
        public CustomStackedItem CreateButton(string name,
                                              string text,
                                              Type externalCommandType,
                                              Action <CustomPushButton> action)
        {
            if (Items.Count == 3)
            {
                throw new InvalidOperationException("You cannot create more than three items in the StackedItem");
            }

            var button = new CustomPushButton(name,
                                              text,
                                              externalCommandType);

            action?.Invoke(button);

            Items.Add(button);

            return(this);
        }