public void CreateCustomRibbonItems()
 {
     ClearRibbonItems();
     var newTab       = new Eplan.EplApi.Gui.RibbonBar().AddTab(_newTabName);
     var commandGroup = newTab.AddCommandGroup(_commandGroupName);
     var command      = commandGroup.AddCommand(_commandName, "CustomActionForRibbonCommand");
 }
Пример #2
0
        public void CreateCustomRibbonItems()
        {
            string _newTabName       = "Custom RibbonItems";
            string _commandGroupName = "Custom CommandGroup";
            string _commandName      = "Part Management Example";

            var newTab       = new Eplan.EplApi.Gui.RibbonBar().AddTab(_newTabName);
            var commandGroup = newTab.AddCommandGroup(_commandGroupName);
            var command      = commandGroup.AddCommand(_commandName, "XPartsManagementStart /PARAM:Script01_CreateCustomRibbonItems");
        }
Пример #3
0
        void cleanItems()
        {
            var newTab = new Eplan.EplApi.Gui.RibbonBar().Tabs.FirstOrDefault(item => item.Name == m_newTabName);

            if (newTab != null)
            {
                var commandGroup = newTab.CommandGroups.FirstOrDefault(item => item.Name == m_commandGroupName);
                if (commandGroup != null)
                {
                    //var command = commandGroup.Commands.Values.FirstOrDefault(item => item.Text == m_commandName);
                    //if(command != null)
                    commandGroup.Remove();
                }
                newTab.Remove();
            }
        }
Пример #4
0
        public void registerItems()
        {
            cleanItems();
            var newTab = new Eplan.EplApi.Gui.RibbonBar().AddTab(m_newTabName);

            var vAllEnumValues       = Enum.GetValues(typeof(Eplan.EplApi.Gui.CommandIcon)).Cast <Eplan.EplApi.Gui.CommandIcon>();
            int nCounterButtons      = 0;
            int nCounterButtonGroups = 0;

            Eplan.EplApi.Gui.RibbonCommandGroup commandGroup = null;

            foreach (var value in vAllEnumValues)
            {
                if ((nCounterButtons % m_ButtonsPerGroup) == 0)
                {
                    commandGroup = newTab.AddCommandGroup(m_commandGroupName + nCounterButtonGroups.ToString());
                    nCounterButtonGroups++;
                }
                commandGroup.AddCommand(value.ToString(), "XPartsManagementStart /PARAM:" + (nCounterButtons++).ToString(), value);
            }
        }
        private void ClearRibbonItems()
        {
            var newTab = new Eplan.EplApi.Gui.RibbonBar().Tabs.FirstOrDefault(t => t.Name == _newTabName);

            if (newTab != null)
            {
                var commandGroup = newTab.CommandGroups.FirstOrDefault(g => g.Name == _commandGroupName);

                if (commandGroup != null)
                {
                    var command = commandGroup.Commands.Values.FirstOrDefault(c => c.Text == _commandName);

                    if (command != null)
                    {
                        command.Remove();
                    }

                    commandGroup.Remove();
                }

                newTab.Remove();
            }
        }