public void Run() { Debug.Assert(this._PowerEDITApp != null); this._AddinState = ExtensionState.Running; //do something... }
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; }
protected override bool OnSetState(ExtensionState state) { // Optionally check for a license here this.State = state; if (state == ExtensionState.Enabled) Initialize(); else Uninitialize(); return base.OnSetState(state); }
protected override bool OnSetState(ExtensionState state) { // Optionally check for a license here this.State = ExtensionState.Enabled; // state; //if (state == ExtensionState.Enabled) // Initialize(); //else // Uninitialize(); return(base.OnSetState(state)); }
public void Shutdown() { Debug.Assert(this.m_UIManager != null); this._AddinState = ExtensionState.Closing; this._PowerDoc.CreatingFindFormCustomFieldsStyles -= OnCreatingFindFormCustomFieldsStyles; this._PowerDoc.BeforeShowingFindFormContextMenuItems -= OnBeforeShowingFindFormContextMenuItems; this._PowerDoc.BeforeDncManualRxOperation -= OnBeforeDncManualRxOperation; this._PowerDoc.BeforeDncTxOperation -= OnBeforeDncTxOperation; this._AddinState = ExtensionState.Closed; }
public void Run() { Debug.Assert(this._PowerEDITApp != null); this._AddinState = ExtensionState.Running; //do something... this._PowerEDITApp.ActiveDocumentChanged += this.OnActiveDocumentChanged; this._PowerEDITApp.DocumentLoaded += this.OnDocumentLoaded; this._PowerEDITApp.DocumentCreated += this.OnDocumentCreated; this._PowerEDITApp.ClosingDocument += this.OnClosingDocument; }
public void Run() { Debug.Assert(this._PowerEDITApp != null); this._AddinState = ExtensionState.Running; this._PowerDoc.CreatingFindFormCustomFieldsStyles += OnCreatingFindFormCustomFieldsStyles; this._PowerDoc.BeforeShowingFindFormContextMenuItems += OnBeforeShowingFindFormContextMenuItems; this._PowerDoc.BeforeDncManualRxOperation += OnBeforeDncManualRxOperation; this._PowerDoc.BeforeDncTxOperation += OnBeforeDncTxOperation; this._PowerDoc.DncManualRxOperationCompleted += OnDncManualRxOperationCompleted; this._PowerDoc.CustomCommandsPanelRequested += OnCustomCommandsPanelRequested; this._PowerDoc.CustomCommandsPanelRequested2 += OnCustomCommandsPanelRequested2; }
private bool CanCreateExtension(ExtensionState state) { var info = state.ExtensionPoint; var extensionId = info.RequiredExtensionPointId; var extensions = this.ElementContainerData.Extensions; if ((info.Cardinality != Cardinality.OneToOne && info.Cardinality != Cardinality.ZeroToOne) || !extensions.Any(p => p.Info.ProvidedExtensionPoints.Any(ep => ep.ExtensionPointId == extensionId))) { return(state.ConditionBindings.All(b => b.Evaluate(state.BindingContext) && b.Value.Evaluate())); } return(false); }
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; }
protected override bool OnSetState(ExtensionState state) { // Optionally check for a license here this.State = state; if (state == ExtensionState.Enabled) { Initialize(); } else { Uninitialize(); } return(base.OnSetState(state)); }
internal static bool CheckLicensing(string id) { bool valid = !string.IsNullOrWhiteSpace(id); if (valid) { FrameworkApplication.State.Activate("prosuite_cartotrials_enabled"); _extensionState = ExtensionState.Enabled; } else { FrameworkApplication.State.Deactivate("prosuite_cartotrials_enabled"); _extensionState = ExtensionState.Disabled; } return(valid); }
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; }
public void Shutdown() { Debug.Assert(this.m_UIManager != null); this._AddinState = ExtensionState.Closing; //UI if (this._DocumentManagementGroup != null) { this.m_UIManager.DetachGroupFromMenuBar(this._DocumentManagementGroup); } //this.m_UIManager.DetachGroupFromMenuBar(this._MesGroup); this.m_UIManager.DestroyMenuBar(this._DocumentManagementBar); //shut down code here... this._AddinState = ExtensionState.Closed; }
/// <summary> /// Execute our authorization check /// </summary> /// <param name="id"></param> /// <returns></returns> internal static bool CheckLicensing(string id) { int val = 0; if (string.IsNullOrEmpty(id) || !Int32.TryParse(id, out val)) { val = -1; //bogus } //Any number divisible by 2 if (val % 2 == 0) { FrameworkApplication.State.Activate("acme_module_licensed"); _extensionState = ExtensionState.Enabled; } else { FrameworkApplication.State.Deactivate("acme_module_licensed"); _extensionState = ExtensionState.Disabled; } return(val % 2 == 0); }
protected override bool OnSetState(ExtensionState state) { try { State = state; Config config = Config.Instance; if (!config.Agreement) { FrmAgreement.OpenForm(); State = ExtensionState.Disabled; } if (Enabled) { var docEvents = ArcUtils.MxDocumentEvents; if (docEvents != null) { docEvents.OpenDocument += OpenDocument; docEvents.CloseDocument += CloseDocument; docEvents.ActiveViewChanged += OnActiveViewChanged; } } else { Uninitialize(); } } catch (Exception ex) { Trace.WriteLine(ex.Message, "GsExtension.OnSetState"); } return(base.OnSetState(State)); }
public ExtensionNode(string name, ExtensionState state) { this.name = name; this.state = state; }
/// <summary> /// Execute our authorization check /// </summary> /// <param name="id"></param> /// <returns></returns> internal static bool CheckLicensing(string id) { int val = 0; if (string.IsNullOrEmpty(id) || !Int32.TryParse(id, out val)) { val = -1; //bogus } //Any number divisible by 2 if (val % 2 == 0) { FrameworkApplication.State.Activate("acme_module_licensed"); _extensionState = ExtensionState.Enabled; } else { FrameworkApplication.State.Deactivate("acme_module_licensed"); _extensionState = ExtensionState.Disabled; } return val % 2 == 0; }