Hi,
I'm trying to create an add-in tool to search (with a wildcard preferably) for feature classes or tables in a GDB or an SDE by right clicking on the GDB/SDE with an option Search and list the search result of that GDB/SDE. Once they are listed, add them to the current map when clicked. Than Aung
Thanks.
Hi Mehdi Pira,
Here is the code snippet you can use, all in all
1. you need to retrieve feature class list from geodatabase instance, by calling GetDefinitions<FeatureClassDefinition>(), from there just retrieve the feature class name by calling GetName method and compare one by one.
Firstly lets have a view model to keep those result.
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">CatalogSearchResultFeatureClassInfo</SPAN> <SPAN class="punctuation token">:</SPAN> NotifyPropertyBase <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">string</SPAN> _featureClassName<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">string</SPAN> FeatureClassName <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">get</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> _featureClassName<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">set</SPAN> <SPAN class="punctuation token">{</SPAN> _featureClassName <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">value</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="token function">OnPropertyChanged</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">string</SPAN> _dbConnectionPath<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">string</SPAN> DbConnectionPath <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">get</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> _dbConnectionPath<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">set</SPAN> <SPAN class="punctuation token">{</SPAN> _dbConnectionPath <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">value</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="token function">OnPropertyChanged</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Next lets implement the search function, this assume user need to select fgdb or sde connection item from catalog.
SearchResult shall be the list of CatalogSearchResultFeaureClassInfo.
All in all read the comment of the process.
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">async</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">PerformSearchFeatureClassCommand</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">object</SPAN> args<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">//get catalog pane</SPAN> ArcGIS<SPAN class="punctuation token">.</SPAN>Desktop<SPAN class="punctuation token">.</SPAN>Core<SPAN class="punctuation token">.</SPAN>IProjectWindow currentProjectWindow <SPAN class="operator token">=</SPAN> Project<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetCatalogPane</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//checking</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>currentProjectWindow <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> MessageBox<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Show</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Please select a geodatabase from catalog"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="comment token">//get the selection</SPAN> <SPAN class="keyword token">int</SPAN> selectionCount <SPAN class="operator token">=</SPAN> currentProjectWindow<SPAN class="punctuation token">.</SPAN>SelectionCount<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>selectionCount <SPAN class="operator token"><=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> MessageBox<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Show</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Please select a geodatabase from catalog"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>SelectedConnection <SPAN class="operator token">=</SPAN> currentProjectWindow<SPAN class="punctuation token">.</SPAN>SelectedItems<SPAN class="punctuation token">.</SPAN><SPAN class="token function">First</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>_gdbPath <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>SelectedConnection<SPAN class="punctuation token">.</SPAN>Path<SPAN class="punctuation token">;</SPAN> Geodatabase geodatabase <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">;</SPAN> Uri gdbPath <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>_gdbPath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> ProgressorSource ps <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ProgressorSource</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Processing search"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//for your output </SPAN> List<SPAN class="operator token"><</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="operator token">></SPAN> outputFeatureclassNameList <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">List</SPAN><SPAN class="operator token"><</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">bool</SPAN> process <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> QueuedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">//check gdb or sde connection</SPAN> <SPAN class="comment token">//apart from that it is handled by user and the properties need to setup manually</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>gdbPath<SPAN class="punctuation token">.</SPAN>AbsoluteUri<SPAN class="punctuation token">.</SPAN><SPAN class="token function">EndsWith</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">".gdb"</SPAN><SPAN class="punctuation token">,</SPAN> StringComparison<SPAN class="punctuation token">.</SPAN>OrdinalIgnoreCase<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> geodatabase <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Geodatabase</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">FileGeodatabaseConnectionPath</SPAN><SPAN class="punctuation token">(</SPAN>gdbPath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>gdbPath<SPAN class="punctuation token">.</SPAN>AbsoluteUri<SPAN class="punctuation token">.</SPAN><SPAN class="token function">EndsWith</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">".sde"</SPAN><SPAN class="punctuation token">,</SPAN> StringComparison<SPAN class="punctuation token">.</SPAN>OrdinalIgnoreCase<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> geodatabase <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Geodatabase</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">DatabaseConnectionFile</SPAN><SPAN class="punctuation token">(</SPAN>gdbPath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>geodatabase <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="comment token">//Now lets search</SPAN> IReadOnlyList<SPAN class="operator token"><</SPAN>FeatureClassDefinition<SPAN class="operator token">></SPAN> fcd <SPAN class="operator token">=</SPAN> geodatabase<SPAN class="punctuation token">.</SPAN>GetDefinitions<SPAN class="operator token"><</SPAN>FeatureClassDefinition<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="comment token">//Get all feature class definition</SPAN> <SPAN class="keyword token">try</SPAN> <SPAN class="punctuation token">{</SPAN> List<SPAN class="operator token"><</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="operator token">></SPAN> featureclassList <SPAN class="operator token">=</SPAN> fcd<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Select</SPAN><SPAN class="punctuation token">(</SPAN>x <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> x<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetName</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">ToList</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//that enhance case in-sensitive search</SPAN> outputFeatureclassNameList <SPAN class="operator token">=</SPAN> featureclassList<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Where</SPAN><SPAN class="punctuation token">(</SPAN>fcn<SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> CultureInfo<SPAN class="punctuation token">.</SPAN>CurrentCulture<SPAN class="punctuation token">.</SPAN>CompareInfo<SPAN class="punctuation token">.</SPAN><SPAN class="token function">IndexOf</SPAN><SPAN class="punctuation token">(</SPAN>fcn<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>SearchInput<SPAN class="punctuation token">,</SPAN> CompareOptions<SPAN class="punctuation token">.</SPAN>IgnoreCase<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">ToList</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">//no result case </SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">return</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> ps<SPAN class="punctuation token">.</SPAN>Progressor<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>process<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> ProDialog<SPAN class="punctuation token">.</SPAN>MessageBox<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Show</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Please select a geodatabase from catalog"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="comment token">//bind this this.searchResult with your UI, Queue task will give you issue if you modify this in the queue task, so Copy back</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>SearchResult <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">List</SPAN><SPAN class="operator token"><</SPAN>CatalogSearchResultFeatureClassInfo<SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">foreach</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">string</SPAN> str <SPAN class="keyword token">in</SPAN> outputFeatureclassNameList<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>SearchResult<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">CatalogSearchResultFeatureClassInfo</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> DbConnectionPath <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>_gdbPath<SPAN class="punctuation token">,</SPAN> FeatureClassName <SPAN class="operator token">=</SPAN> str <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
For the add the result item into map, try and bind the searchresult variable to grid or listbox or something , bind with a variable in your viewmodel let say - variable name as SelectedFC,
You can follow this code => LayerFactory.Instance.CreateLayer(new Uri("your feature class path"), map)
Below is the code snippet, which will be helpful for you.
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">async</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">AddToCurrentMap</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> mapView <SPAN class="operator token">=</SPAN> MapView<SPAN class="punctuation token">.</SPAN>Active<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>mapView <SPAN class="operator token">!=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">try</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">string</SPAN> currentFCPath <SPAN class="operator token">=</SPAN> Path<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Combine</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>_gdbPath<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN>SelectedFC<SPAN class="punctuation token">.</SPAN>FeatureClassName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> ps <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">ProgressorSource</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Adding the feature class.."</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="comment token">//lets display progress dialog so it look nicer for user, took sometime so lets user sit tight and wait</SPAN> <SPAN class="keyword token">await</SPAN> QueuedTask<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> LayerFactory<SPAN class="punctuation token">.</SPAN>Instance<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>currentFCPath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN> mapView<SPAN class="punctuation token">.</SPAN>Map<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">,</SPAN> ps<SPAN class="punctuation token">.</SPAN>Progressor<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token class-name">Exception</SPAN> ex<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> MessageBox<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Show</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Unable to add feature class into map"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//oops I got error, better log here</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> MessageBox<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Show</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Please activate a map view to add layer"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">return</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Brilliant! That's what I was looking for.
Thanks indeed Than Aung
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.