I am working on a tool that uses a dockpane to display results from features in a box from a maptool. I actually have already created this tool with a windows form and it works really well except for one issue that I don't think can be resolved, so I'm looking at the dockpane, which I believe is the only other way to get a form in Pro. However, I open the dockpane, then draw the box with the maptool, and when I call a function in the dockpane a null reference exception is returned. The data that I'm passing to the dockpane is not null, and I even tested it without passing any data and the dockpane still comes back null.
I am using Esri sample "MapToolIdentifyWithDockpane" as a reference, and I have everything set up the same way as in that sample. The sample works, mine does not.
I have this in the config.daml for the dockpane:
<dockPanes>
<dockPane id="CustomIDDockPane_dpIDTools" caption="dpIDTools" className="dpIDToolsViewModel" dock="float" dockWith="esri_core_projectDockPane">
<content className="dpIDToolsView" />
</dockPane>
</dockPanes>
This is what I have in Module1 to define the dockpane:
internal class Module1 : Module
{
private static Module1 _this = null;
private static dpIDToolsViewModel _dpIDToolsVM = null;
public static Module1 Current
{
get
{
return _this ?? (_this = (Module1)FrameworkApplication.FindModule("CustomIDDockPane_Module"));
}
}
internal static dpIDToolsViewModel dpIDToolsVM { get; set; }
}
I call this from the tool, this is where the error occurs:
Module1.dpIDToolsVM.LoadIDResults(mapLayerNames, feat);
This is the code in the viewmodel that the above line is calling:
internal void LoadIDResults(List<string> layerNames, Dictionary<BasicFeatureLayer, List<long>> featureLayerList)
{
List<IDFeaturesInLayer> iList = new List<IDFeaturesInLayer>();
foreach (KeyValuePair<BasicFeatureLayer, List<long>> b in featureLayerList)
{
IDFeaturesInLayer i = new IDFeaturesInLayer();
i.Value = b.Key;
i.Text = b.Key.ToString();
iList.Add(i);
}
}
Thank you in advance for any assistance offered.
Jeff