Message 1 of 3

Not applicable
09-20-2018
04:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to check whether someone should be able to use my addin based on the entitlement API. But I'm not sure how to pass a variable between an event handler and a class.
private Boolean Purchased = false; public Result OnStartup(UIControlledApplication application) { AddRibbonPanel(application); application.ControlledApplication.ApplicationInitialized += ControlledApplication_ApplicationInitialized; Autodesk.Windows.RibbonControl ribbon = Autodesk.Windows.ComponentManager.Ribbon; foreach (Autodesk.Windows.RibbonTab tab in ribbon.Tabs) { if (tab.Name == "MyTab") { foreach (Autodesk.Windows.RibbonPanel panel in tab.Panels) { panel.IsEnabled = this.Purchased; } } } // end of entitlement api status check return Result.Succeeded; }
The event handler in line 5 check the REST resonse and sets 'Purchased' to true, but it doesn't seem to execute before for each loop. Is there a way to force the event to trigger first? Or what effective strategies can we use to enable/disable our plugins based in the EntitlementAPI?
thanks in advance
Solved! Go to Solution.