|
POST
|
i would convert the custom mxd into an ArcGIS Pro project file (.aprx). To start ArcGIS Pro i would simply start a new process: Process.Start Method (System.Diagnostics) | Microsoft Learn by using the ArcGIS Pro executable followed by the .aprx project file name. This will open ArcGIS Pro with your .aprx custom project. To get path of the ArcGIS Pro executable you have to look at the ArcGIS Pro installation path in the registry (programmatically), the following community sample has the code to retrieve the installation location: arcgis-pro-sdk-community-samples/Program.cs at master · Esri/arcgis-pro-sdk-community-samples (github.com) On the ArcGIS Pro side i would install a custom ArcGIS add-in with the following 'autoLoad' setting changed in the config.daml (this will cause the add-in to load at startup of Pro and not be JIT loaded): <insertModule id="..." className="Module1" autoLoad="true" ...>
For interprocess communication (IPC) i would use 'Anonymous Pipes' AnonymousPipeServerStream Class (System.IO.Pipes) | Microsoft Learn Needless to say there is the client equivalent: AnonymousPipeClientStream Class (System.IO.Pipes) | Microsoft Learn To exchange data i would write the data into a shared CSV file and use the IPC to inform the add-in of any new data files and the add-in can take care of loading / displaying the data. ArcGIS Pro add-ins are multi-threaded extensions and are well suited to support IPC.
... View more
04-17-2023
04:04 PM
|
1
|
1
|
2137
|
|
POST
|
I tested your code snippet and it works fine. I don't understand what you mean with "ShowDialog() is not blocking". What version of Pro are you using and how do you close the Pro Window? Try using the 'X' on the top right of the window to close it. Here's the snippet i used for the ProWindow above (it's identical to what you have except for the properties). try
{
if (_oauthConsent != null)
return;
_oauthConsent = new ModalProWindow();
_oauthConsent.Owner = FrameworkApplication.Current.MainWindow;
_oauthConsent.Closed += (o, e) => { _oauthConsent = null; };
//this._oauthConsent.webBrowser.NavigationStarting += new EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2NavigationStartingEventArgs>(browser_Navigated);
//this._oauthConsent.webBrowser.Source = new Uri(this._uri);
var result = this._oauthConsent.ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show($@"ex");
}
... View more
04-17-2023
10:02 AM
|
0
|
1
|
3343
|
|
POST
|
Or you can try to use the RowCreatedEvent to capture all new rows (and their object ids). try
{
var mapView = MapView.Active;
if (mapView == null) return;
var polygonLayer = mapView.Map.GetLayersAsFlattenedList()
.OfType<BasicFeatureLayer>().FirstOrDefault (lyr => lyr.Name == "TestPolygons");
var lineLayer = mapView.Map.GetLayersAsFlattenedList()
.OfType<BasicFeatureLayer>().FirstOrDefault(lyr => lyr.Name == "TestLines");
if (polygonLayer == null || lineLayer == null)
{
throw new Exception($@"The split action requires both Layers: TestPolygons and TestLines");
}
QueuedTask.Run(() =>
{
ArcGIS.Core.Events.SubscriptionToken token = null;
try
{
// create an edit operation
EditOperation splitOperation = new()
{
Name = "Split polygons",
ProgressMessage = "Working...",
CancelMessage = "Operation canceled.",
ErrorMessage = "Error splitting polygons",
SelectModifiedFeatures = false,
SelectNewFeatures = false
};
var splitTargetSelectionDictionary = new Dictionary<MapMember, List<long>>
{
{ polygonLayer, polygonLayer.GetSelection().GetObjectIDs().ToList() }
};
var splittingSelectionDictionary = new Dictionary<MapMember, List<long>>
{
{ lineLayer, lineLayer.GetSelection().GetObjectIDs().ToList() }
};
// initialize a list of ObjectIDs that to be split (selected TestPolygons)
var splitTargetSelectionSet = SelectionSet.FromDictionary(splitTargetSelectionDictionary);
// initialize the list of ObjectIDs that are used for the splitting (selected TestLines)
var splittingSelectionSet = SelectionSet.FromDictionary(splittingSelectionDictionary);
// perform the Split operation:
// To be split (selected TestPolygons)
// Used for the splitting (selected TestLines)
splitOperation.Split(splitTargetSelectionSet, splittingSelectionSet);
// start listening to RowCreate events in order to collect all new rows
List<long> newOids = new();
token = ArcGIS.Desktop.Editing.Events.RowCreatedEvent.Subscribe((ev) =>
{
newOids.Add (ev.Row.GetObjectID());
}, polygonLayer.GetTable());
var result = splitOperation.Execute();
if (result != true || splitOperation.IsSucceeded != true)
throw new Exception($@"Edit 1 failed: {splitOperation.ErrorMessage}");
System.Diagnostics.Trace.WriteLine($@"Number of new rows: {newOids.Count}");
}
catch
{
throw;
}
finally
{
if (token != null)
ArcGIS.Desktop.Editing.Events.RowCreatedEvent.Unsubscribe(token);
}
});
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
... View more
04-13-2023
03:09 PM
|
1
|
1
|
1560
|
|
POST
|
I am not sure what you mean with dataframe, but this is what my code snippet does: Before running the code snippet, my Map is using the NAD 1983 spatial reference After i run my code snippet that Spatial Reference changed to Web Mercator
... View more
04-13-2023
11:05 AM
|
0
|
0
|
2202
|
|
POST
|
The validation is working for me. You can specify the BrowseFilter / Filter properties to further restrict the input options. SaveItemDialog Class—ArcGIS Pro
... View more
04-13-2023
10:37 AM
|
0
|
1
|
1668
|
|
POST
|
Your code snippet has a problem, this line doesn't make much sense when GPRun returns void, plus a closing ')' is missing: var Agg_para = Geoprocessing.MakeValueArray(intersectFC, intersectSortFC, GPRun("management.Sort", Agg_para, null,null,outputOnMapNone); i would suggest setting a breakpoint before you call Geoprocessing.ExecuteToolAsync and inspect the content of the parameters array to make sure the content looks correct. If you run the same GP tool manually you can look at the corresponding python command to get the proper parameter sequence for the input parameters array.
... View more
04-13-2023
09:25 AM
|
0
|
1
|
1064
|
|
POST
|
Sorry about that, i created this sample in my attachment above for the 3.2 community sample release. To get it to work with ArcGIS Pro 3.0 or 3.1, you have to change the minimum desktop version of the add-in in the config.daml: Change this line in config.daml: <AddInInfo id="{b69d8233-0ca5-49ea-adc4-80ad26e2a8ed}" version="1.0" desktopVersion="3.2.48119"> To the following in order for the add-in to work with release 3.0 of ArcGIS Pro: <AddInInfo id="{b69d8233-0ca5-49ea-adc4-80ad26e2a8ed}" version="1.0" desktopVersion="3.0.0">
... View more
04-13-2023
09:11 AM
|
1
|
0
|
2813
|
|
POST
|
In order to change the Spatial Reference for the Map you have to use the SetSpatialReference of the Map class: SetSpatialReference Method (Map)—ArcGIS Pro. For this you have to use QueuedTask.Run: try
{
// Get the active map view.
var mapView = MapView.Active;
if (mapView == null) return;
// If Spatial Reference is already have Web Mecartor do nothing
if (mapView.Map.SpatialReference.Equals(SpatialReferences.WebMercator)) return;
_= QueuedTask.Run(() =>
{
// Run within QueuedTask
mapView.Map.SetSpatialReference(SpatialReferences.WebMercator);
});
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString ());
}
... View more
04-13-2023
09:06 AM
|
0
|
1
|
2207
|
|
POST
|
The errors you are seeing are coming from the XAML Designer in Visual Studio. Unfortunately, Microsoft introduced a bug into the Designer where the Designer fails to locate required assemblies (this issue was introduced when we switched from x86/x64 mixed builds to x64 builds). When you close the XAML Designer these errors are cleared. These errors do not have any effect on the actual build. Also Visual Studio and MSBuild seem to have no problem finding those assemblies. I reported this issue to Microsoft but they claimed to have this issue fixed. Regarding your second question: Calling the dockpane from one of the buttons in the ribbon though, only leads to a busy system and the dockpane is never shown. You need to step through your code to see what's going on. Usually when you click on a show dockpane button the Onclick method is called in the ViewModel file created by the dockpane item template. Try to set a breakpoint there, if that works, set breakpoints in you dockpane constructor etc. In general, these types of errors occur after partially renaming ids or classes, or sometimes multiple open instances of ArcGIS Pro prevent the add-in from being installed properly. If you create a new add-in and then add item templates (like dockpanes etc.) to the project without modifying any files the add-in should work properly and open the dockpane, so i would look at the modification you made to the project after you used the item templates. If you find a specific code snippet that is causing the hang you can share it here and we can help you out.
... View more
04-12-2023
11:58 AM
|
1
|
0
|
1997
|
|
POST
|
I attached a sample with a drop down list of features, however, the features are extracted from a feature layer (specifically the States layer) not a feature class. You can change the code by using @MatthewDriscoll 's snippet in order to get the drop down list data from a feature class. I would also suggest that you get familiar with the Pro SDK you can find the Pro SDK landing page here: ArcGIS Pro SDK | Documentation As data for the attached sample i used the 'C:\Data\Admin\AdminSample.aprx' project & data which is distributed through the community samples release page (see link above).
... View more
04-12-2023
10:17 AM
|
1
|
3
|
2831
|
|
POST
|
I can't duplicate your problem with a Dockpane containing a listbox. The focus on the listbox is maintained on my sample. I attached the sample for your reference. Without seeing some sample code showing your issue it's usually not possible to duplicate a problem.
... View more
04-08-2023
12:01 PM
|
0
|
0
|
534
|
|
POST
|
I attached a sample add-in project that opens all .aprx projects under a given folder (including all .aprx file in subfolders) and checks if the aprx has an open Map Pane, if it doesn't have an open Map Pane, the add-in takes the first Map and creates a map pane, then saves the project file. Note that you might get prompted for input at some time and execution is slow at times because the add-in is using time outs for some operations. To use the app, set a start folder and click the start button.
... View more
04-07-2023
09:03 AM
|
1
|
4
|
3197
|
|
POST
|
A bit late, but i just wanted to explain how KeyTips (defined in your add-in's config.daml) can be used in ArcGIS Pro. For the screenshots in my illustration below i used the "RibbonControls" community sample: arcgis-pro-sdk-community-samples/Framework/RibbonControls at 6078006a3943364f2a7931b19d1eb03c8a99e1cf · Esri/arcgis-pro-sdk-community-samples (github.com) In order to use KeyTips in ArcGIS Pro (after you opened a project) you must first press the Alt key or the F10 key, this shows all available KeyTip letters for tabs on the Pro ribbon: Next you press any of displayed KeyTips letters (white and framed in black). So for example to get to the “Sample Tab” I simply press the ‘X’ key. Now the UI is updated to show the ‘Sample Tab’s’ Key Tips: Finally, I can choose a KeyTip from the selected ‘Sample Tab’ tab. For example, if I want to execute the ‘Button 2’ command on the ‘Sample Tab’, I simply press the ‘X’ key followed by the ‘E’ key. The command is executed, and I get this:
... View more
04-05-2023
11:10 AM
|
0
|
0
|
1353
|
|
POST
|
Follow the steps outlined here: ProConcepts Editing · Esri/arcgis-pro-sdk Wiki (github.com) But change the insert attribute for the insertComponent tag to insert="after". <categories>
<updateCategory refID="esri_editing_AttributeTabs">
<insertComponent ....
<content guid="XXX"... placeWith="esri_editing_AttributeTabGeometry"
insert="after" />
</insertComponent>
</updateCategory>
... View more
04-05-2023
07:14 AM
|
0
|
0
|
738
|
|
POST
|
Not sure how the installation directory for ArcGIS Pro would fix the “Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=7.0.0.0, C..." issue. Can you elaborate? Where did you install ArcGIS Pro?
... View more
04-04-2023
03:09 PM
|
0
|
1
|
2777
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-07-2025 07:27 AM | |
| 2 | 2 weeks ago | |
| 1 | 07-30-2025 12:03 PM | |
| 1 | 10-06-2025 01:19 PM | |
| 1 | 10-06-2025 10:37 AM |
| Online Status |
Offline
|
| Date Last Visited |
9 hours ago
|