I just moved to ArcGIS Pro 3.1 and had to migrate my Visual Studio 2022 Google Streetview Add In from 2.x to 3.x. I used the "Pro Migration Solution" extension tool in VS, but even afterwards, although the project Built okay, the Add In failed with a system error. It turns out that the .NET Windows Desktop Runtime 6.0 (the new .NET framework), requires a change in the way that the Process.Start (url) is called. I've copied my script below, which includes the syntax used for the Process.Start call:
using System.Threading.Tasks;
using System.Diagnostics;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping;
namespace StreetviewPro
{
internal class StreetviewPro : MapTool
{
protected override void OnToolMouseDown(MapViewMouseButtonEventArgs e)
{
if (e.ChangedButton == System.Windows.Input.MouseButton.Left)
e.Handled = true; //Handle the event args to get the call to the corresponding async method
}
protected override Task HandleMouseDownAsync(MapViewMouseButtonEventArgs e)
{
return QueuedTask.Run(() =>
{// Convert the clicked point in client coordinates to the corresponding map coordinates.
MapPoint mapPoint = MapView.Active.ClientToMap(e.ClientPoint);// convert to lon/lat
MapPoint coords = (MapPoint)GeometryEngine.Instance.Project(mapPoint, SpatialReferences.WGS84);
// open a web browser
string url = string.Format("http://maps.google.com/?cbll={0},{1}&cbp=12,90,0,0,5&layer=c", coords.Y, coords.X);
Process.Start(new ProcessStartInfo (url) { UseShellExecute = true });
});
}
public StreetviewPro()
{
//IsSketchTool = true;
//SketchType = SketchGeometryType.Rectangle;
//SketchOutputMode = SketchOutputMode.Map;
}
protected override Task OnToolActivateAsync(bool active)
{
return base.OnToolActivateAsync(active);
}
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
return base.OnSketchCompleteAsync(geometry);
}
}
}
That script made my StreetView Add In work in ArcGIS Pro 3.1
Hopefully, someone else finds this info useful 🙂