Hi,
I have gotten a use case where if button in an Addin UI is missing somehow I have to disable other functionalities. So basically if that button is not visible in the UI then how to disable other functionalities dependent on that button because I don't want user to use those functionalities.
Any help!
@Wolf @GKmieliauskas @CharlesMacleod
@GKmieliauskas is quite correct as you need to implement your own states and conditions to control your Add-in's UI. There is a ProGuide to states and conditions here: ProGuide Code Your Own States and Conditions · Esri/arcgis-pro-sdk Wiki (github.com)
Then in your add-in's module class you can check for the existence of the needed Add-in using the FrameworkApplication API:
var theNeededModule = FrameworkApplication.FindModule("NeededModule");
The Module ID "NeededModule" can be found in the Add-in module's config.daml file:
... <modules> <insertModule id="NeededModule" className="Module1" autoLoad="false" ...>
If theNeededModule value is null the needed add-in is not available otherwise the needed add-in is available. You can use that value to control your states and conditions.
Yes Addin not installed can be an only use case I can think of.
@Wolf
Can you elaborate why a button would be missing from the UI? Is the Add-in not installed ? If the Add-in is installed why would the button be missing? I don't understand your use case for this.
1. Create new condition in module daml
2. Deactivate created condition in add-in module Initialize method
protected override bool Initialize() { FrameworkApplication.State.Deactivate("your_condition_name"); }
3. In your specific button constructor activate created condition
public YourSpecificButton() { FrameworkApplication.State.Activate("your_condition_name"); }
4. Add condition to related tools in daml
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.