public void Initialize(IPowerEDITApp pweApp) { if (pweApp == null) { throw new ArgumentNullException(nameof(pweApp)); } //eventuale controllo su stato non running this._AddinState = ExtensionState.Initailizing; this._PowerEDITApp = pweApp; this._DocumentManagementBar = new UIMenuBarInfo(this, DOCUMENTMANAGEMENTCAPTION, AddinMenuBarTarget.AddinCustomBar); this.m_UIManager.CreateMenuBar(this._DocumentManagementBar); this._DocumentManagementGroup = new UIMenuBarGroupInfo(this, this._DocumentManagementBar, DOCUMENTMANAGEMENTGROUPCAPTION); this.m_UIManager.AppendGroupToMenuBar(this._DocumentManagementBar, this._DocumentManagementGroup); // New document button this._NewDocumentButton = new UIMenuBarItemInfo(this, this._DocumentManagementGroup, NEWDOCUMENTBUTTONCAPTION, AddinMenuItemType.Button, Properties.Resources.TS_LogoSmall_32); this.m_UIManager.AppendItemToMenuGroup(this._DocumentManagementGroup, this._NewDocumentButton); // Move button this._MoveButton = new UIMenuBarItemInfo(this, this._DocumentManagementGroup, MOVEBUTTONCAPTION, AddinMenuItemType.Button, Properties.Resources.TS_LogoSmall_32); this.m_UIManager.AppendItemToMenuGroup(this._DocumentManagementGroup, this._MoveButton); // Replace button this._ReplaceButton = new UIMenuBarItemInfo(this, this._DocumentManagementGroup, REPLACEBUTTONCAPTION, AddinMenuItemType.Button, Properties.Resources.ReplaceIcon); this.m_UIManager.AppendItemToMenuGroup(this._DocumentManagementGroup, this._ReplaceButton); // Add button this._AddDataButton = new UIMenuBarItemInfo(this, this._DocumentManagementGroup, ADDDATABUTTONCAPTION, AddinMenuItemType.Button, Properties.Resources.TS_LogoSmall_32); this.m_UIManager.AppendItemToMenuGroup(this._DocumentManagementGroup, this._AddDataButton); // Add button only for admin var powerDoc = this._PowerEDITApp.PowerDOCConnector; if (powerDoc.GetCurrentUser().AccessLevel == PowerDOCUserAccessLevel.Administrator) { this._OnlyAdminButton = new UIMenuBarItemInfo((IPowerEDITExtension)this, this._DocumentManagementGroup, ONLYADMINBUTTONCAPTION, AddinMenuItemType.Button, Properties.Resources.TS_LogoSmall_32); this.m_UIManager.AppendItemToMenuGroup(this._DocumentManagementGroup, this._OnlyAdminButton); } this._AddinState = ExtensionState.Initialized; }
public void Initialize(IPowerEDITApp pweApp) { if (pweApp == null) { throw new ArgumentNullException(nameof(pweApp)); } //eventuale controllo su stato non running this._AddinState = ExtensionState.Initailizing; this._PowerEDITApp = pweApp; this._PowerDoc = pweApp.PowerDOCConnector; this._AddinState = ExtensionState.Initialized; }
public void Initialize(IPowerEDITApp pweApp) { if (pweApp == null) { throw new ArgumentNullException(nameof(pweApp)); } //eventuale controllo su stato non running this._AddinState = ExtensionState.Initailizing; this._PowerEDITApp = pweApp; //inizializzazioni varie... //UI //prendo il riferimento alla barra principale (Power) List <UIMenuBarInfo> defBars = this.m_UIManager.GetDefaultMenuBars(); UIMenuBarInfo homeBar = defBars.FirstOrDefault(b => b.BarType == AddinMenuBarTarget.Home); this._MyHomeGroup = new UIMenuBarGroupInfo(this, homeBar, MYHOMEGROUPCAPTION); this.m_UIManager.AppendGroupToMenuBar(homeBar, this._MyHomeGroup); this._MyCommandButton2 = new UIMenuBarItemInfo(this, this._MyHomeGroup, MYCOMMAND2BUTTONCAPTION, AddinMenuItemType.Button, Properties.Resources.TS_LogoSmall_32); this.m_UIManager.AppendItemToMenuGroup(this._MyHomeGroup, this._MyCommandButton2); //aggiungo una barra per comandi speciali this._MyAdvancedBar = new UIMenuBarInfo(this, MYBARCAPTION, AddinMenuBarTarget.AddinCustomBar); this.m_UIManager.CreateMenuBar(this._MyAdvancedBar); // this._MyGroup1 = new UIMenuBarGroupInfo(this, this._MyAdvancedBar, MYGROUP1CAPTION); this.m_UIManager.AppendGroupToMenuBar(this._MyAdvancedBar, this._MyGroup1); this._MyCommandButton1 = new UIMenuBarItemInfo(this, this._MyGroup1, MYCOMMAND1BUTTONCAPTION, AddinMenuItemType.Button, Properties.Resources.TS_LogoSmall_32); this.m_UIManager.AppendItemToMenuGroup(this._MyGroup1, this._MyCommandButton1); this._AddinState = ExtensionState.Initialized; }