Calling Class from another namespace in Config.daml

438
3
04-24-2020 03:16 AM
SreenivasaRaoPigili
Occasional Contributor

Hi All,

   I am trying to segregated tools and its corresponding function classes into separate projects. 

Followed the below documentation - 

ProGuide Diagnosing ArcGIS Pro Add ins · Esri/arcgis-pro-sdk Wiki · GitHub 

ProConcepts Framework · Esri/arcgis-pro-sdk Wiki · GitHub  

1. Created two projects called addIn.ProjectA and userLibrary.ProjectB.

addIn.ProjectA is the add-in project. This has config.daml file

userLibrary.ProjectB is the project where tools functionality available.

      namespace userLibrary.ProjectB

            internal class testButtonFunction : Button

2. Crosschecked that the addIn.ProjectA's  AssemblyName and Default Namespace is same as in Config.daml's default assembly and defaultnamespace values.

3. added userLibrary.ProjectB's Namespace reference to addIn.ProjectA.

4. in the config.daml added below line

<button id="testButton" caption="testButtonFromNewConfig" className="userLibrary.ProjectB.testButtonFunction"
loadOnClick="true" smallImage="Images\hello.png" largeImage="Images\hello.png" >
<tooltip heading="testButtonFromNewConfig">
testButtonFromNewConfig<disabledText />
</tooltip>
</button>

But still the button is unable to call the corresponding class. Please help me.

Thanks in advance.

Note:    If we are having both config.daml and the tools functionality in the same project - we dont have any issues.

Regards,

Sreeni.

Tags (1)
0 Kudos
3 Replies
SreenivasaRaoPigili
Occasional Contributor

Charles Macleod - Can you please help me.

0 Kudos
CharlesMacleod
Esri Regular Contributor

Hi Sreeni, apologies for the delay but we were testing this configuration. The bottom line is that the classes referred to in the DAML must be in the add-in assembly. Therefore, to distribute functionality across multiple assemblies, in general, there are two choices (and variations thereof):

Spread the functionality across multiple add-ins.The "master" add-in, for example, defines the Tabs and the "optional" add-ins update the Tab(s) with their buttons and so forth. 

Within the add-in use a containment pattern to load the library classes/functions that do the "work" within the buttons, etc.

public class AddinButton : ... {

    private SomeLibraryClass _doRealWork = null;

    protected override void OnClick() {
       if (_doRealWork == null) {
          _doRealWork = new SomeLibraryClass(...);
       }
       //etc

There is a third option that involves Categories but that is beyond the scope of this post. If you are interested in that please review these samples and watch this technical session:

ConfigureGallery sample

CustomCategories sample

Advanced Pro UI Customization, Dev Summit 2019. Advance to 36:17.

0 Kudos
SreenivasaRaoPigili
Occasional Contributor

Charles Macleod: Thank you for your response.I will take a look into these options and will update you. Thanks again.

0 Kudos