|
POST
|
Thanks Sean Jones, The main issue I am having is getting around this line of code: IFeature inFeature = (IFeature)obj; This causes problems when an edit in a Table or something that isn't a 'Feature' occurs. Currently I'm just wrapping a Try...Catch around it, but is there a better way to do this?? With the help you gave me with the ArcGIS Pro version of this tool I am creating, I was able to subscribe to certain layers, but with ArcMap it looks like this code will run on any row edit/Create. Is that right?? protected override void OnStartup()
{
IEditor theEditor = ArcMap.Editor;
Events.OnStartEditing += new IEditEvents_OnStartEditingEventHandler(Events_OnStartEditing);
Events.OnStopEditing += new IEditEvents_OnStopEditingEventHandler(Events_OnStopEditing);
}
void Events_OnStartEditing()
{
//Since features of shapefiles, coverages, and so on, cannot be validated, ignore wiring
//events for them.
if (ArcMap.Editor.EditWorkspace.Type !=
esriWorkspaceType.esriFileSystemWorkspace)
{
//Wire OnCreateFeature edit event.
Events.OnCreateFeature += new IEditEvents_OnCreateFeatureEventHandler
(Events_OnCreateChangeFeature);
//Wire onChangeFeature edit event.
Events.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler
(Events_OnCreateChangeFeature);
}
}
//Invoked when a feature is created or modified.
void Events_OnCreateChangeFeature(ESRI.ArcGIS.Geodatabase.IObject obj)
{
try
{
IFeature inFeature = (IFeature)obj;
try
{
ITable inTable = obj.Table;
IVersionedObject3 vObject = (IVersionedObject3)inTable;
if (vObject.IsRegisteredAsVersioned)
if (inFeature.Fields.FindField("LASTUSER") != -1 && inFeature.Fields.FindField("DATEMODIFIED") != -1)
{
//MessageBox.Show("Fields found....this will be edited.");
inFeature.set_Value(inFeature.Fields.FindField("LASTUSER"), System.Security.Principal.WindowsIdentity.GetCurrent().Name);
inFeature.set_Value(inFeature.Fields.FindField("DATEMODIFIED"), DateTime.Now.ToString());
return;
}
else
{
//MessageBox.Show("Fields not found");
return;
}
}
catch (Exception ex)
{
//MessageBox.Show("Not versioned!!");
return;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Not a valid Feature");
}
}
... View more
04-24-2019
10:23 AM
|
0
|
6
|
2482
|
|
POST
|
Yes, you will need to: 1. add the Image to your project (I normally use .PNG but I think other formats will work too) 2. as Gintautas said, make the Build Action 'AddInContent' 3. modify the Config.daml to reference the image from step #1.
... View more
04-24-2019
08:15 AM
|
2
|
1
|
4815
|
|
POST
|
This seems to work. If you know of a better way to do this, or see issues with this, please let me know. IFeature inFeature = (IFeature)obj;
ITable inTable = obj.Table;
IVersionedObject3 vObject = (IVersionedObject3)inTable;
if (vObject.IsRegisteredAsVersioned)
if (inFeature.Fields.FindField("LASTUSER") != -1 && inFeature.Fields.FindField("DATEMODIFIED") != -1)
{
MessageBox.Show("Fields found....this will be edited.");
return;
}
else
{
MessageBox.Show("Fields not found");
return;
}
... View more
04-23-2019
11:45 AM
|
0
|
8
|
2482
|
|
IDEA
|
A great idea. I also have had many issues when having many tables/maps in the same .aprx file. It often gets very confusing. Even a toggle button within the Options to enable/disable only viewing the tables for selected maps would be great.
... View more
04-23-2019
11:23 AM
|
5
|
1
|
6443
|
|
POST
|
Thanks Kory. Yes, that kind of works, but still a bit of a mucky way of dealing with tables/maps. Christina Lindsay, making an ArcGIS Idea out of this is a great idea!
... View more
04-23-2019
10:58 AM
|
0
|
1
|
2224
|
|
POST
|
Hi, I'm creating an Editor Extension and in my Events.OnChangeFeature I need to determine if the current feature being edited is Versioned. How do I do this?? Currently my code crashes at the casting of the IFeature to IVersionedObject3. //Invoked when a feature is created or modified.
void Events_OnCreateChangeFeature(ESRI.ArcGIS.Geodatabase.IObject obj)
{
try
{
IFeature inFeature = (IFeature)obj;
IVersionedObject3 vObject = (IVersionedObject3)inFeature;
if (vObject.IsRegisteredAsVersioned)
if (inFeature.Fields.FindField("LASTUSER") != -1 && inFeature.Fields.FindField("DATEMODIFIED") != -1)
{
MessageBox.Show("Versioned....this will be edited.");
return;
}
else
{
MessageBox.Show("Fields not found");
return;
}
MessageBox.Show("Not versioned!!");
return;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
... View more
04-23-2019
10:43 AM
|
0
|
9
|
2631
|
|
POST
|
Hi, I cannot figure out how to disable the Minimize and Maximize buttons on a ProWindow. I see the choices for Appearance - Window Style, but even setting it at ToolWindow the Min/Max buttons are still there: <controls:ProWindow x:Class="RowChanged_TEST.ProWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
mc:Ignorable="d"
Title="Tracked Layers" Height="470.347" Width="300"
WindowStartupLocation="CenterOwner" ResizeMode="CanResizeWithGrip" WindowStyle="ToolWindow"
>
<controls:ProWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</controls:ProWindow.Resources>
<Grid>
<ListBox x:Name="lstLayers" Margin="10,37,10,10" BorderBrush="{DynamicResource Esri_TextControlBrush}" FontSize="14"/>
<Label x:Name="label" Content="Map Frame - Layer Name" Foreground="{DynamicResource Esri_TextControlBrush}" HorizontalAlignment="Left" Height="35" Margin="10,2,0,0" VerticalAlignment="Top" Width="195" FontSize="15"/>
</Grid>
</controls:ProWindow>
Any ideas on what might be going on??
... View more
04-18-2019
11:37 AM
|
0
|
2
|
1664
|
|
POST
|
Thanks Daniel, Do you know if this 'History' can be updated manually? It appears as if it gets updated after a Geoprocessing Tool or another tool in a Toolbox is run, but what I want to do is add entries as custom .NET Add-Ins run. I'm looking at the HistoryProjectItem class, but can't seem to figure it out. https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic11042.html
... View more
04-18-2019
06:58 AM
|
0
|
0
|
3455
|
|
POST
|
Nice!! Here is the final code: //This checks to make sure the layer is Versioned
private bool IsVersioned(FeatureLayer fLayer)
{
try
{
//Use this to avoid errors on Layers with Joined Tables
if (fLayer.GetTable().IsJoinedTable())
{
Join theJoin = fLayer.GetTable().GetJoin();
Table theTable = theJoin.GetOriginTable();
Geodatabase tableGDB = (Geodatabase)theTable.GetDatastore();
if (tableGDB.IsVersioningSupported())
return true;
else
return false;
}
Geodatabase theGDB = (Geodatabase)fLayer.GetFeatureClass().GetDatastore();
if (theGDB.IsVersioningSupported())
{
//MessageBox.Show("Yes, versioning supported for " + fLayer.URI);
return true;
}
return false;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error in 'IsVersioned' procedure:");
return false;
}
} Thanks for your help!
... View more
04-18-2019
05:49 AM
|
1
|
0
|
2699
|
|
POST
|
Hi Rich, Well I've found a compromise that pretty much works, although not perfectly. Doing this.... //This checks to make sure the layer is Versioned
private bool IsVersioned(FeatureLayer fLayer)
{
try
{
//Use this to avoid errors on Joined Tables...not really checking if Versioned, but the next best thing
if (fLayer.GetTable().IsJoinedTable())
{
if (fLayer.IsEditable)
return true;
else
return false;
}
Geodatabase theGDB = (Geodatabase)fLayer.GetFeatureClass().GetDatastore();
if (theGDB.IsVersioningSupported())
{
//MessageBox.Show("Yes, versioning supported for " + fLayer.URI);
return true;
}
return false;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error in 'IsVersioned' procedure:");
return false;
}
} ...seems to work. In our situation the worse that will happen is some fields in a joined shapefile or PGDB might also get flagged as 'Versioned', but it's not a huge problem. At least the SDE Feature Classes with joins will still get picked up.
... View more
04-17-2019
12:08 PM
|
0
|
2
|
2699
|
|
POST
|
Hi Rich, So is it any type of Join that will cause the 'Datastore' to be invalid?? I have also tried with a join to a FGDB table, and still get the same error - Datastore is invalid. Is there a way to determine if a layer with a join is Versioned?? Basically I'm creating a tool to 'watch' for edits on layers as they happen (ie. RowChangedEvent, etc.). But I only need to watch for edits on valid layers, which are layers in our Corporate SDE....so Versioned layers. I figured checking to see if the layer is Versioned would be the easiest way of doing this, but when joins are present things don't work although edits could still be happening. Any ideas on the best work-around for this??
... View more
04-17-2019
06:56 AM
|
0
|
4
|
2699
|
|
POST
|
Hi Rich, Basically what I am doing is parsing the Connection String to see if the current layer is versioned. Is there a better way of doing this (ie. figuring out if a layer is versioned or not)??
... View more
04-15-2019
12:07 PM
|
0
|
6
|
2699
|
|
POST
|
Ummmm....not quite sure what you are asking for. If all you want to do is open the application from MS Access using VBA, then you could try something like this: https://www.techonthenet.com/access/modules/other_app.php There is no VB6 dll for ArcGIS Pro.
... View more
04-12-2019
11:28 AM
|
0
|
0
|
2281
|
|
POST
|
In ArcMap there was the 'Results' pane...see screenshot below. Is there an equivalent to this for ArcGIS Pro?? I notice that when you run a Geoprocessing Tool, a messagbox will appear that you can click on to get more details. I'm assuming that this is the replacement for the 'Results' pane? What is this, and how do I get access to it through the API in order to present custom messages to users as tools are running, or completed running.
... View more
04-12-2019
11:21 AM
|
0
|
3
|
3691
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-29-2026 07:40 AM | |
| 1 | 10-17-2023 07:40 AM | |
| 1 | 04-14-2026 08:54 AM | |
| 2 | 08-18-2023 08:57 AM | |
| 1 | 04-13-2018 10:07 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-29-2026
09:43 AM
|