I have about 14 feature layers, and i want to be able to switch our the Data Source URL from my code if it does not match the environment I am in. i would even settle for being able to just drop and re-add the layer if it has a different datasource then the one I want to load. Unfortunately, I cant seem to find how to Get/Set this value for a layer? I attached a screen shot of what I want to get/set
FeatureLayer LoadLayer <SPAN class="operator token">=</SPAN> <SPAN class="token function">GetBasicFeaturLayer</SPAN><SPAN class="punctuation token">(</SPAN>entry<SPAN class="punctuation token">.</SPAN>Key<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> FeatureLayer<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>LoadLayer <SPAN class="operator token">==</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">//Not already on the Map, load it</SPAN>
<SPAN class="punctuation token">{</SPAN>
Uri uri <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>NEWurl <SPAN class="operator token">+</SPAN> entry<SPAN class="punctuation token">.</SPAN>Value<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
LoadLayer <SPAN class="operator token">=</SPAN> LayerFactory<SPAN class="punctuation token">.</SPAN>Instance<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateFeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN>uri<SPAN class="punctuation token">,</SPAN> MapView<SPAN class="punctuation token">.</SPAN>Active<SPAN class="punctuation token">.</SPAN>Map<SPAN class="punctuation token">,</SPAN> position<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="comment token">//HERE</SPAN>
<SPAN class="comment token">//HERE</SPAN>
<SPAN class="comment token">//I need to check if the layer that already exists on the map has a different datasource</SPAN>
<SPAN class="comment token">//IF CURRENT URL != NEWurl</SPAN>
<SPAN class="comment token">//If Not equal, then remove existing layer or some how redo the data source </SPAN>
<SPAN class="comment token">//Here is the remove logic, but I would rather rename, but I first need to find out if datasouce is different</SPAN>
<SPAN class="token function">RemoveBasicFeaturLayer</SPAN><SPAN class="punctuation token">(</SPAN>entry<SPAN class="punctuation token">.</SPAN>Key<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
Uri uri <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>NEWurl <SPAN class="operator token">+</SPAN> entry<SPAN class="punctuation token">.</SPAN>Value<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
LoadLayer <SPAN class="operator token">=</SPAN> LayerFactory<SPAN class="punctuation token">.</SPAN>Instance<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateFeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN>uri<SPAN class="punctuation token">,</SPAN> MapView<SPAN class="punctuation token">.</SPAN>Active<SPAN class="punctuation token">.</SPAN>Map<SPAN class="punctuation token">,</SPAN> position<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>