AnsweredAssumed Answered

Enumerate Layers in Map Package

Question asked by mark.oberg on Feb 2, 2015
Latest reply on Feb 2, 2015 by TTilton-esristaff

What is the proper way to enumerate layers in MPK package generate from a personal geodatabase without using a MapView control?  All the examples use the MapView or hard-code an index of the layer needed.  Here is code (VB.NET):

 

Dim map As Esri.ArcGISRuntime.LocalServices.LocalFeatureService = _
     Await Esri.ArcGISRuntime.LocalServices.LocalFeatureService.StartAsync(mpkPath)
Dim i As Integer = 0
Do While True
  Dim sfTable As Esri.ArcGISRuntime.Data.ServiceFeatureTable = Nothing
  Try
       sfTable = Await Esri.ArcGISRuntime.Data.ServiceFeatureTable.OpenAsync(New Uri(map.UrlMapService & "/" & i))
  Catch ex As Exception
       sfTable = Nothing
  End Try
  If sfTable Is Nothing Then
       Exit Do
  End If
  ' Do something with sfTable
  i += 1
Loop

Is this the proper way of enumerating until you get a 404 error when you're passed the last index ?

 

Thanks in advance,

Mark Oberg

Outcomes