Select to view content in your preferred language

Integration and configuration of custom commands in a ProTask

589
4
Jump to solution
08-26-2022 03:12 AM
DirkTillmanns
New Contributor III

Hi,

in a step of a Pro Task it is possible for some commands that shows a dockpane, to integrate the resulting dockpane into the dialog of the task interface. For example, this works for the "Create" (show create feature pane). This is activated via the "Enabled" checkbox.

Can someone give me a hint how custom commands that display a dockpane could use this possibility? Can this be done via a configuration in config.daml? Or programmatic?

Thank you for your help

Dirk

DirkTillmanns_0-1661507464231.png

DirkTillmanns_2-1661507639034.png

 

 

0 Kudos
1 Solution

Accepted Solutions
NarelleChedzey
Esri Contributor

Dirk, 

 

Each type of customization that is part of the DAML file must be assigned a unique ID.  We call this the damlID.   So when you define a button in your add-in it has a damlID.  In the example below the damlID is "acme_AddFromFileButton"

  <button id="acme_AddFromFileButton"
      className=" AddFromFile"
      caption="Add from file"
      keytip="AF"
      largeImage="Images\AddFromFile32.png"
      smallImage="Images\AddFromFile16.pngg">
    <tooltip heading="Add from file" image="Images\AddFromFile16.png">
      Add spatial data files to the project
      <disabledText>Requires an open project with a map</disabledText>
    </tooltip>
  </button>

 

Similarly defining and registering a component in a category requires that the item have a unique damlID.  In this definition the damlID is "esri_mapping_bookmarks".   Internally we prefix our damlIds with "esri_(moduleName)"  so this example belongs to the mapping module. 

 

So your daml entry for the emebeddable control category might look like the following

 

 

 

 

<categories>
  <updateCatgeory refID="esri_tasks_embeddableControls">
    <insertComponent id="unity_editor_embeddedControlID" className="embeddedControlViewModel">
      <content className="embeddedControlView" relatedCommand="unity_editor_CreateAssetsButton" autoRunOnly="true"/>
    </insertComponent>
  </updateCategory>
</categories>

 

 

 

 where embeeddedcontrolviewModel and embeddedControlView are the classes from step 2 that I explained above.   And "unity_editor_CreateAssetsButton" is the damlID of the button that launches your dockPane defined in step 3.

 

Regards

Narelle

 

View solution in original post

4 Replies
DirkTillmanns
New Contributor III

 

 

I found an approach myself, but the view of my dockpane doesn't look really good.😂

DirkTillmanns_1-1661524569534.png

 

DirkTillmanns_0-1661524495589.png

 

0 Kudos
NarelleChedzey
Esri Contributor

Dirk,  

 

You will likely have to restructure some of your code to fully implement the ability of embedding your dockpane into the Tasks pane. 

 

The daml category that you found ("esri_tasks_embeddableControls") is the correct category to register your code in order for Tasks to recognize it as a component that can be embedded.  But the view/viewModel that the daml entry references via the className attribute should be a class that inherits from ArcGIS.Desktop.Framework.Controls.EmbedableControl.  You can create one of these using the Visual Studio template.   

 

Internally we typically follow the below steps for this pattern.

1. create an internal control and viewModel pair to hold the UI and code behind.

2. create an EmbeddableControl (a view and viewmodel  pair) that hosts and instantiates the control and the control's view model from step1

3. create a DockPane (a view and viewmodel pair) that hosts and instantiate the control and the control's view model from step1.

4. The esri_tasks_embeddableControls daml entry reference the view/viewmodel from step 2.  The "relatedCommand" attribute in that same daml entry references the buttonID that launches the dockpane from step 3. 

 

As you can see, this is an advanced extension pattern that has a certain amount of complexity involved.  

I hope this information helps to get you started.    Let me know if you have additional questions. 

Narelle

0 Kudos
DirkTillmanns
New Contributor III

Hi Narelle,

Thank you very much for your reply. I can understand this to some extent using "Manage Bookmarks" ae an example. But I have a question about "id=esri_mapping_bookmarks". What kind of ID is it? Is it a component number? What would such a component equivalent be in a separate AddIn?

 

DirkTillmanns_2-1661948793292.png

 

DirkTillmanns_0-1661948661939.png

 

0 Kudos
NarelleChedzey
Esri Contributor

Dirk, 

 

Each type of customization that is part of the DAML file must be assigned a unique ID.  We call this the damlID.   So when you define a button in your add-in it has a damlID.  In the example below the damlID is "acme_AddFromFileButton"

  <button id="acme_AddFromFileButton"
      className=" AddFromFile"
      caption="Add from file"
      keytip="AF"
      largeImage="Images\AddFromFile32.png"
      smallImage="Images\AddFromFile16.pngg">
    <tooltip heading="Add from file" image="Images\AddFromFile16.png">
      Add spatial data files to the project
      <disabledText>Requires an open project with a map</disabledText>
    </tooltip>
  </button>

 

Similarly defining and registering a component in a category requires that the item have a unique damlID.  In this definition the damlID is "esri_mapping_bookmarks".   Internally we prefix our damlIds with "esri_(moduleName)"  so this example belongs to the mapping module. 

 

So your daml entry for the emebeddable control category might look like the following

 

 

 

 

<categories>
  <updateCatgeory refID="esri_tasks_embeddableControls">
    <insertComponent id="unity_editor_embeddedControlID" className="embeddedControlViewModel">
      <content className="embeddedControlView" relatedCommand="unity_editor_CreateAssetsButton" autoRunOnly="true"/>
    </insertComponent>
  </updateCategory>
</categories>

 

 

 

 where embeeddedcontrolviewModel and embeddedControlView are the classes from step 2 that I explained above.   And "unity_editor_CreateAssetsButton" is the damlID of the button that launches your dockPane defined in step 3.

 

Regards

Narelle