Solved! Go to Solution.
<Grid> <esri:Map x:Name="_map" UseAcceleratedDisplay="True" > <!-- ArcGIS Online Tiled Basemap Layer --> <esri:ArcGISTiledMapServiceLayer ID="World Topo Map" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> <!--Local Feature Layer--> <esri:ArcGISLocalFeatureLayer ID="arcGISLocalFeatureLayer" Path="M:\ArcGIS\Databases\SOPFIM_Full.mpk" UpdateCompleted="ArcGISLocalFeatureLayer_UpdateCompleted" LayerName="ContourQC"> </esri:ArcGISLocalFeatureLayer> </esri:Map> <StackPanel> <TextBlock x:Name="txtBlock" VerticalAlignment="Top" HorizontalAlignment="Left"></TextBlock> <TextBlock x:Name="countBlock" VerticalAlignment="Top" HorizontalAlignment="Left"></TextBlock> </StackPanel> </Grid>
public MainWindow()
{
var localFeatureService = new LocalFeatureService()
{
MaxRecords = 10000,
Path = @"M:\ArcGIS\Databases\SOPFIM_Full.mpk",
};
localFeatureService.Start();
InitializeComponent();
}
private void ArcGISLocalFeatureLayer_UpdateCompleted(object sender, System.EventArgs e)
{
var layer = (sender as ArcGISLocalFeatureLayer);
this.txtBlock.Text = layer.ExceededTransferLimit.ToString();
this.countBlock.Text = layer.Graphics.Count.ToString();
}
...
<Grid.Resources>
<esri:LocalFeatureService x:Key="FeatureService" Path="C:\Temp\SOPFIM_Full.mpk" MaxRecords="1000000" />
</Grid.Resources>
...
<esri:ArcGISLocalFeatureLayer ID="arcGISLocalFeatureLayer"
Service="{StaticResource FeatureService}"
LayerName="ContourQC" IsHitTestVisible="False"/>
<Window.Resources>
<esri:LocalFeatureService x:Key="FeatureService" Path="Data\\SOPFIM_Full.mpk" MaxRecords="3000" EnableDynamicLayers="True"/>
<esri:SimpleRenderer x:Key="MySimpleRenderer">
<esri:SimpleRenderer.Symbol>
<esri:SimpleFillSymbol BorderBrush="Blue" BorderThickness="4" Fill="Red"/>
</esri:SimpleRenderer.Symbol>
</esri:SimpleRenderer>
</Window.Resources>
<Grid>
<esri:Map x:Name="_map" UseAcceleratedDisplay="True" IsEnabled="false" >
<!-- ArcGIS Online Tiled Basemap Layer -->
<esri:ArcGISTiledMapServiceLayer ID="World Topo Map"
Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
<esri:ArcGISLocalDynamicMapServiceLayer Service="{StaticResource FeatureService}">
</esri:ArcGISLocalDynamicMapServiceLayer>
<esri:GraphicsLayer ID="Results" Renderer="{StaticResource MySimpleRenderer}"></esri:GraphicsLayer>
</esri:Map>
</Grid>
public partial class MainWindow : Window
{
private const string PATH = "Data\\SOPFIM_Full.mpk";
private LocalMapService _mapService;
public MainWindow()
{
InitializeComponent();
LocalMapService.GetServiceAsync(PATH, localMapService =>
{
_mapService = localMapService;
_map.IsEnabled = true;
});
this._map.MouseClick += (s, e) =>
{
var graphicsLayer = _map.Layers["Results"] as GraphicsLayer;
graphicsLayer.ClearGraphics();
var task = new IdentifyTask(_mapService.UrlMapService);
var identifyParameters = new IdentifyParameters()
{
Geometry = e.MapPoint,
SpatialReference = _map.SpatialReference,
MapExtent = _map.Extent,
Width = (int)_map.ActualWidth,
Height = (int)_map.ActualHeight,
LayerOption = LayerOption.all
};
task.ExecuteCompleted += (se, ea) =>
{
if (ea.IdentifyResults != null && ea.IdentifyResults.Count > 0)
{
var layer = _map.Layers["Results"] as GraphicsLayer;
ea.IdentifyResults.ForEach(x => layer.Graphics.Add(x.Feature));
}
};
task.Failed += (se, ea) => MessageBox.Show(ea.Error.ToString());
task.ExecuteAsync(identifyParameters);
};
}