POST
|
I want to stop or warn a user of the deletion of a feature in the RowDeletedEvent. When the user tries to delete the field I want to ask them if they are sure. I want to roll back or something if they don't want to delete the item. protected static void onRowDeleteEvent(RowChangedEventArgs args)
{
try
{
MessageBox.Show("Are you Sure", "Are you Sure", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Warning);
//ROLL BACK HERE?
}
catch (Exception e)
{
ProMapBlackLogWriter.logError("ProMapBlackModule - onRowDeleteEvent", e);
}
}
... View more
12-12-2017
11:43 AM
|
0
|
5
|
1102
|
POST
|
Nevermind. I thought there would be a command, but i just did this return QueuedTask.Run(() =>
{
if (MapView.Active != null && MapView.Active.Map != null)
{
MapView.Active.Map.SetSelection(null);
}
};
... View more
11-30-2017
06:47 AM
|
5
|
0
|
874
|
POST
|
I can't seem to find the simple logic to clear all map selections? Am I missing something here?
... View more
11-30-2017
06:41 AM
|
1
|
1
|
1167
|
POST
|
I am using the sample logic to get recent projects var fileInfos = Project.GetRecentProjects().Select(f => new FileInfo(f));
But I want to know how to clear this list in code. I want to update the user.config that stores the recent projects. ArcGIS Pro does this when you try and open a recent project that no longer exists. If you click on one, it will prompt you and ask you if you want to remove the project. I have made a custom start page that loads the recent projects, but when a user clicks on a recent project from the list (that has been deleted from system), ArcGIS Pro Crashes. I have attached the out of the box Prompt behavior that i want to mimic in the Pro SDK.
... View more
11-07-2017
03:34 PM
|
1
|
2
|
701
|
POST
|
We had some constraints on our database an ID and some other fields are required. So when we tried to create the feature, Pro would signal an error as the insert wasn't allowed. We removed the constraint now, as we will require the user to enter them, or we will auto enter them in the OnRowCreate event. We also need to do this because the definition query uses certain attributes to determine what the user can see. Basically we are prompting a user with a dialog box whenever a new feature is created. Before the dialog appears, we set some required attributes about their location. The user then is required on the form to enter certain information. They will not be able to close the form unless all required attributes are satisfied. If they hit cancel on this new feature form, the feature is then deleted.
... View more
11-02-2017
07:09 AM
|
0
|
0
|
950
|
POST
|
I am indeed using a feature service, and you are correct, HasValueChanged it always returning true even when I don't change anything. Get Original Value is also always returning null as you mentioned, so i have know way of comparing geometries either in the OnRowChangedEvent. I need to know if the shape changed or just an attribute. But it looks like both aren't working. Thanks for your help on this, and if you can think of any other work around that would be great. My only option now until the bug is addressed, is to possible calculate the area of the polygon and to see if it matches an already saved area? Unless you can think of anything easier? Matt
... View more
11-02-2017
06:56 AM
|
0
|
0
|
287
|
POST
|
I cant seem to figure out how to determine if the Row Change was a geometry change only? I need to know if the change that triggered this row change was an attribute change, or if someone just moved a vertices or something. I have tried both of these in my onRowChangeEvent and neither seem to work for both attribute only changes or geometry only changes. int shapeIndex = args.Row.GetTable().GetDefinition().FindField("Shape"); bool shapeChanged = args.Row.HasValueChanged(shapeIndex); bool shapeChanged2 = (Geometry)args.Row.GetOriginalValue(shapeIndex) != (Geometry)args.Row[shapeIndex]; protected async void onRowChangeEvent(RowChangedEventArgs args)
{
//Polygon selectedLine = inspr["SHAPE"] as Polygon;
int shapeIndex = args.Row.GetTable().GetDefinition().FindField("Shape");
//These both seem to always return true even if it is a attribute only change
bool shapeChanged = args.Row.HasValueChanged(shapeIndex);
bool shapeChanged2 = (Geometry)args.Row.GetOriginalValue(shapeIndex) != (Geometry)args.Row[shapeIndex];
}
... View more
11-01-2017
07:49 AM
|
0
|
2
|
377
|
POST
|
My problem is, is that my RowChangedEvent or Row Created Event are never hit, because the row can't be inserted without a certain required attribute value being present. I get the "Bad Syntax in request" in ArcGIS Pro, before any events even get hit. The database requires 4 of my attributes be populated. Do i have to remove database constraints in order to use the feature service model? Is there an event that is triggered before the RowCreated that I could prompt the user for values or modify the rows, much like we have done here for row created/changed.
... View more
10-31-2017
04:38 AM
|
0
|
2
|
950
|
POST
|
Ok, i was able to subscribe to all of my layers using the code below to subscribe and unsubscribe using the tokens. So i was able to catch when a new layer row was added, changed, or deleted. The only problem is that some of the attributes for my feature layer are required by user input so they are not able to be created (so I get bad syntax in request). Is there a way to set some attribute values before the row is actually created? Before in ArcObjects, we were in an edit session, so onCreateFeature, I would set these values, but now it creates the Row first and then it fails before my code gets hit. I need to set the values first, before the row gets added. protected override bool Initialize() { ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); return base.Initialize(); } protected override void Uninitialize() { ActiveMapViewChangedEvent.Unsubscribe(OnActiveMapViewChanged); foreach (SubscriptionToken token in rowCreateTokens) { RowCreatedEvent.Unsubscribe(token); } foreach (SubscriptionToken token in rowChangeTokens) { RowChangedEvent.Unsubscribe(token); } foreach (SubscriptionToken token in rowDeleteTokens) { RowDeletedEvent.Unsubscribe(token); } base.Uninitialize(); } #endregion Overrides private async void OnActiveMapViewChanged(ActiveMapViewChangedEventArgs activeMapViewChangedEventArgs) { await subscribeToRowEvent(); } private static List<SubscriptionToken> rowCreateTokens = new List<SubscriptionToken>(); private static List<SubscriptionToken> rowChangeTokens = new List<SubscriptionToken>(); private static List<SubscriptionToken> rowDeleteTokens = new List<SubscriptionToken>(); protected Task subscribeToRowEvent() { return QueuedTask.Run(() => { if (MapView.Active != null && MapView.Active.Map != null) { var editLayers = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>(); if (editLayers.Count() == 0) return; foreach (var layer in editLayers) { //Listen for row events on a layer var layerTable = layer.GetTable(); //subscribe to row events SubscriptionToken rowCreateToken = RowCreatedEvent.Subscribe(onRowCreateEvent, layerTable); SubscriptionToken rowChangeToken = RowChangedEvent.Subscribe(onRowChangeEvent, layerTable); SubscriptionToken rowDeleteToken = RowDeletedEvent.Subscribe(onRowDeleteEvent, layerTable); rowCreateTokens.Add(rowCreateToken); rowChangeTokens.Add(rowChangeToken); rowDeleteTokens.Add(rowDeleteToken); } } }); } protected void onRowCreateEvent(RowChangedEventArgs args) { Console.WriteLine("onRowCreateEvent " + args.EditType.ToString()); } protected void onRowChangeEvent(RowChangedEventArgs args) { Console.WriteLine("onRowChangeEvent " + args.EditType.ToString()); } protected void onRowDeleteEvent(RowChangedEventArgs args) { Console.WriteLine("onRowDeleteEvent " + args.EditType.ToString()); }
... View more
10-30-2017
12:22 PM
|
0
|
4
|
950
|
POST
|
So i was trying to subscribe in the Configuration Manager and not the Module like it is suppose to be. i got the subscribe to work, but do i have to run this subscribe for every layer that I want to monitor change, create, and delete for? protected override bool Initialize() { subRowEvent(); return base.Initialize(); } #endregion Overrides protected void subRowEvent() { QueuedTask.Run(() => { //This is where i need help getting all layers and add listener for each?? foreach layer in layersList??? { //Listen for row events on a layer var featLayer = layer as FeatureLayer; var layerTable = featLayer.GetTable(); //subscribe to row events var rowCreateToken = RowCreatedEvent.Subscribe(onRowEvent, layerTable); var rowChangeToken = RowChangedEvent.Subscribe(onRowEvent, layerTable); var rowDeleteToken = RowDeletedEvent.Subscribe(onRowEvent, layerTable); } }); }
... View more
10-30-2017
11:28 AM
|
0
|
5
|
950
|
POST
|
I want to catch all Row Created and Row Changed events. When i catch them, to have edit events based on which class was being edited. However, i can't figure out where to subscribe at. When i do the following in the Configuration Manager, ArcGIS Pro constantly says "Drawing". In ArcObjects, i did all this work in an "Editor" extension I made that caught all of the Creates, Changes, and Deletes. I think this is what i need, but I can't figure out where to put the subRowEvent? protected override void OnApplicationInitializing(CancelEventArgs cancelEventArgs) { var theme = FrameworkApplication.ApplicationTheme; //ApplicationTheme enumeration if (FrameworkApplication.ApplicationTheme != ApplicationTheme.Dark) { //Dark theme FrameworkApplication.ApplicationTheme = ApplicationTheme.Dark; } subRowEvent(); } protected void subRowEvent() { QueuedTask.Run(() => { //Listen for row events on a layer var featLayer = MapView.Active.GetSelectedLayers().First() as FeatureLayer; var layerTable = featLayer.GetTable(); //subscribe to row events var rowCreateToken = RowCreatedEvent.Subscribe(onRowEvent, layerTable); var rowChangeToken = RowChangedEvent.Subscribe(onRowEvent, layerTable); var rowDeleteToken = RowDeletedEvent.Subscribe(onRowEvent, layerTable); }); } protected void onRowEvent(RowChangedEventArgs args) { Console.WriteLine("RowChangedEvent " + args.EditType.ToString()); }
... View more
10-30-2017
09:24 AM
|
0
|
6
|
1456
|
POST
|
I have a Dock pane, that when it closes, i want to remove the selection changed event. Then when i reopen it, I want to resubscribe. Is there a better way to do this than by tracking the subscribed with a boolean? I don't want it on when the dockpane is hidden, but i want it to be available again when I bring the pane back to showing. I can't seem to simply unsubscribe and resubscribe like i want because OnShow gets called like 3 times when the pane is loaded and adds multiple Subscribes. protected AttributeEditorViewModel() { MapSelectionChangedEvent.Subscribe(OnMapSelectionChanged); subscribed = true; } ~AttributeEditorViewModel() { MapSelectionChangedEvent.Unsubscribe(OnMapSelectionChanged); subscribed = false; } protected override void OnHidden() { if (subscribed) { MapSelectionChangedEvent.Unsubscribe(OnMapSelectionChanged); subscribed = false; } } protected override void OnShow(bool isVisible) { if (!isVisible || subscribed) { MapSelectionChangedEvent.Unsubscribe(OnMapSelectionChanged); subscribed = false; } else { MapSelectionChangedEvent.Subscribe(OnMapSelectionChanged); subscribed = true; } }
... View more
10-24-2017
03:37 PM
|
0
|
1
|
654
|
POST
|
In my configuration project, my startup page allows a user to pick a "Location", using this location I create a new project for them. I then want to get the MapView and load up some feature layers for that location and zoom to that location. But it seems i have to wait for the Map to load before i can do what I want. So I call this Command from my xaml BlankProjectCommand public ICommand BlankProjectCommand { get { return new RelayCommand((args) => BlankSelectionViewModelHelper.NewBlankProject(_Location), () => true); ; } } Then it returns this function NewBlankProject, but the following function wont work fully because i cant reference the MapView.Active.Map as I want to load some feature layers for the Location and zoom to that location. Is there anyway I can wait for the map to load after var newProject = await Project.CreateAsync(cps); internal static async void NewBlankProject(string inLocation) { string defaultName = inLocation; string defaultFolder = DefaultFolder(); string templatePath = GetDefaultMapTemplate(); //Map if (!string.IsNullOrEmpty(defaultFolder) && !string.IsNullOrEmpty(templatePath)) { var cps = new CreateProjectSettings() { Name = defaultName, LocationPath = DefaultFolder(), TemplatePath = GetDefaultMapTemplate() }; var newProject = await Project.CreateAsync(cps); if (MapView.Active != null && MapView.Active.Map != null) { MapSettings newMapSettings = new MapSettings(); newMapSettings.PlantCode = inPlantCode; newMapSettings.HarvestYear = inHarvestYear; newMapSettings.HarvestTrimester = inHarvestTrimester; newMapSettings.MaterialGroup = inMaterialGroup; newMapSettings.Environment = Settings.CurrentEnvironment; List<UserPlantData> UserPlantDataList = new List<UserPlantData>(); UserPlantDataList = await WebServiceUtility.GetUserPlantDataAsync(); if (!newMapSettings.Equals(Settings.CurrentMapSettings)) { await FeatureServiceManagement.LoadFeatureServiceAsync(newMapSettings); await Navigation.ZoomToPlantExtentAsync(); } } }
... View more
10-24-2017
01:05 PM
|
0
|
5
|
4630
|
POST
|
Thank You Uma. That is exactly what i wanted. Along with the ArcGIS Pro Install on the client machines, i will add the following to a batch command. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\ArcGISPro\Settings" /v "ConfigurationFolder" /t REG_SZ /d "X:\Pro\Install\" /f This works and now my shortcut command first looks to X:\Pro\Install\ for the latest configuration. I am also going to clear out the C:\Users\Public\Documents\ArcGIS\ArcGISPro\Configurations folder and %LOCALAPPDATA%\ESRI\ArcGISPro\AssemblyCache in this batch file as well. That way my configuration will be the only one loaded. For debugging in visual studio, I had to clear this registry value when I wanted to debug my configuration program in visual studio, otherwise it went to my share folder and loaded that configuration instead of my debug one. Here is that command i put in a script too. reg delete HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\ArcGISPro\Settings /v ConfigurationFolder /f Thank You Matt
... View more
10-17-2017
10:14 AM
|
0
|
0
|
448
|
POST
|
I am working on a Configuration project that i want to deploy to a common network location that all of my worldwide users can access. Lets say all users have a mapped directory X:\Pro\Install Within that Install directory i have the file Pro.proConfigX. I want to create a desktop shortcut on their individual computers that reference the latest config on the network share. i don't want the user to have to install the config to get the latest version and put it in their know good folder. I don't want the user to have to run the install on the config. Instead of this "C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe" /config:Pro.proConfigX I want this "C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe" /config:X:\Pro\Install\Pro.proConfigX I have tried all possible combinations of the /config switch and can't get it to work. I have tried quotes, double backslashes, etc. Nothing seems to work. It appears the user has to install the .proConfigX everytime there is an update. I am not able to reference a known location for a configuration like I am an addin. Any Ideas?
... View more
10-16-2017
11:40 AM
|
0
|
2
|
596
|
Title | Kudos | Posted |
---|---|---|
1 | 08-23-2018 06:49 AM | |
1 | 08-02-2023 08:28 AM | |
1 | 01-03-2020 10:54 AM | |
1 | 11-30-2017 06:41 AM | |
1 | 08-20-2018 01:10 PM |
Online Status |
Offline
|
Date Last Visited |
a month ago
|