//cad.de test of TheMuew using Eplan.EplApi.Base; using Eplan.EplApi.Gui; using Eplan.EplApi.Scripting; using System.Collections.Generic; public class EPLAN_PersonalRibbon { public static string _ownTabName = "cad.de: TheMue TAB"; [DeclareRegister] public void Register_EPLAN_PersonalRibbon() { this.CreateRibbon(); } [DeclareUnregister] public void UnRegister_EPLAN_PersonalRibbon() { this.RemoveRibbon(); } [DeclareEventHandler("Eplan.EplApi.OnMainStart")] public void EPLANStart() { //create Ribbon on EPLAN start this.CreateRibbon(); } [DeclareEventHandler("Eplan.EplApi.OnMainEnd")] public void EPLANEnd() { this.RemoveRibbon(); } public void RemoveRibbon() { var ownRibbonTab = new Eplan.EplApi.Gui.RibbonBar().GetTab(_ownTabName); if (ownRibbonTab != null) { foreach (var _commandGroup in ownRibbonTab.CommandGroups) { if (_commandGroup != null) { _commandGroup.Remove(); } } ownRibbonTab.Remove(); } } public void CreateRibbon() { this.RemoveRibbon(); var ribbonTab = new Eplan.EplApi.Gui.RibbonBar().AddTab(_ownTabName); RibbonCommandGroup ribbonCommandGroupSc = ribbonTab.AddCommandGroup("Scripte"); ribbonCommandGroupSc.AddCommand("Scripte ausführen", "SelectScriptDlg", new RibbonIcon(CommandIcon.Rectangle_A)); ribbonCommandGroupSc.AddCommand("Scripte laden", "RegisterScriptDlg", new RibbonIcon(CommandIcon.Rectangle_L)); ribbonCommandGroupSc.AddCommand("Scripte entladen", "ApiScriptRegisteredScriptsDlgAction", new RibbonIcon(CommandIcon.Rectangle_E)); } }