Hey Charles, can you provide some more clarity on what "automatically checking out" means? I've run the code below through 3 different scenarios:
- Named User license with 3D Analyst configured on the server.
- Concurrent Use license with 3D Analyst checked out via the License Configuration window.
- Concurrent Use license with 3D Analyst NOT checked out via the License Configuration window (screenshot below).
Scenarios 1 and 2 work fine, but Scenario 3 errors with code 2147483647. What does that code mean? The first line in the code returns that a license is available in all 3 scenarios, even though the UI says the Visibility tool is unavailable in Scenario 3.
My understanding of "automatically check out" is that the the UI will detect that an add-in needs a license, poll the license server, and check one out. Is that correct? If it makes any difference, I'm using a Basic license. This is important functionality because we can't expect our users to remember to check-out and check-in a license every time they want to use our tools.
Debug.WriteLine($"3D Analyst license available: {LicenseInformation.IsAvailable(LicenseCodes.Analyst3D)}");
var progressorSource = new CancelableProgressorSource("Creating visibility raster", "");
var paramDictionary = new Dictionary<string, string>();
paramDictionary.Add("in_raster", elevationRaster);
paramDictionary.Add("in_observer_features", observerLayerName);
paramDictionary.Add("out_raster", rasterPath);
var environments = Geoprocessing.MakeEnvironmentArray(
outputCoordinateSystem: MapView.Active.Map.SpatialReference,
extent: MapView.Active.Extent);
var result = await Geoprocessing.ExecuteToolAsync("Visibility_3d", paramDictionary.Values,
environments, progressorSource.Progressor, GPExecuteToolFlags.RefreshProjectItems | GPExecuteToolFlags.AddToHistory);
Thanks!