I don't want to get a wrapper command (with GetPlugInWrapper.)
I just need to access some methods that I have defined in my inherited Tool class definition.
(I Think that I can identify the tool instance by its ID since I have just one instance (?))
internal class PickupTool : MapTool { /// <summary> /// Define the tool as a sketch tool that draws a rectangle in screen space on the view. /// </summary> public PickupTool() { IsSketchTool = true; SetSketchType(Settings.Default.GfxPickOption); UseSnapping = true; SketchOutputMode = SketchOutputMode.Screen; } public void SetSketchType(PickToolOptions gfxPickOption) { switch (gfxPickOption) { case PickToolOptions.Point: SketchType = SketchGeometryType.Point; Cursor = GetCursor("PointCursor.cur"); break; ...
From a ribbon button/menu I need to call the method in line 14.
Solved! Go to Solution.
Found a solution:
I save the instance in the module when I create it.
Can you please provide detail on how you did this.
Thank you,
internal class PickupTool : MapTool
{
/// <summary>
/// Define the tool as a sketch tool that draws a rectangle in screen space on the view.
/// </summary>
public PickupTool()
{
IsSketchTool = true;
SetSketchType(Settings.Default.GfxPickOption);
UseSnapping = true;
SketchOutputMode = SketchOutputMode.Screen;
Module1.GfxPickupTool = this;
}
Module1:
private PickupTool m_gfxPickupTool;
public static PickupTool GfxPickupTool
{
get
{
return Current?.m_gfxPickupTool;
}
set
{
if (Current != null)
Current.m_gfxPickupTool = value;
}
}
Config.daml:
<tool id="GFXModule_PairTool" caption="Pair Feature" className="PickupTool" loadOnClick="true" smallImage="Images\Rings32.png" largeImage="Images\Rings32.png" condition="esri_mapping_mapPaneOrLayoutPane">
<tooltip heading="Pair">
Pair Feature from the Map<disabledText /></tooltip>
</tool>
Thank you for your quick reply.