I am looking to clear the cache on the selected layer. I am able to get it to work on either a Service Layer or a Feature layer. What I am trying to do now is have it detect which type the layer is so that it can refresh using the corrct code. I am stuck on trying to detect the layer type. Any thoughts? TIA.
Public Overrides Sub OnClick()
Dim slayer As ServiceLayer
Dim flayer As FeatureLayer
If ESRI.ArcGISExplorer.Application.Application.SelectedItems(0).GetType = ServiceLayer Then
slayer = TryCast(ESRI.ArcGISExplorer.Application.Application.SelectedItems(0), ServiceLayer)
slayer.ClearCache()
System.Windows.Forms.MessageBox.Show("The cache for the selected layer has been cleared!", "CACHE", Windows.Forms.MessageBoxButtons.OK)
ElseIf ESRI.ArcGISExplorer.Application.Application.SelectedItems(0).GetType = FeatureLayer Then
flayer = TryCast(ESRI.ArcGISExplorer.Application.Application.SelectedItems(0), FeatureLayer)
flayer.ClearCache()
System.Windows.Forms.MessageBox.Show("The cache for the selected layer has been cleared!", "CACHE", Windows.Forms.MessageBoxButtons.OK)
Else : System.Windows.Forms.MessageBox.Show("The cache for the selected layer could not be cleared due to incorrect layer type!", "CACHE", Windows.Forms.MessageBoxButtons.OK)
End If
End Sub