/// <summary> /// Starts animating the location. /// </summary> private void UpdateLocation() { if (Map != null && Map.SpatialReference != null && GeoCoordinate != null && GeoCoordinate != GeoCoordinate.Unknown) { MapPoint newLocation = new ESRI.ArcGIS.Client.Geometry.MapPoint(GeoCoordinate.Longitude, GeoCoordinate.Latitude) { SpatialReference = new SpatialReference(4326) }; if (!Map.SpatialReference.Equals(newLocation.SpatialReference)) { if (WebMercatorSR.Equals(Map.SpatialReference)) { newLocation = merc.FromGeographic(newLocation) as MapPoint; } else { if (ProjectionService != null) { if (!ProjectionService.IsBusy) { var geom = newLocation; EventHandler <Tasks.GraphicsEventArgs> handler = null; handler = (a, b) => { (a as IProjectionService).ProjectCompleted -= handler; if (b.Results != null && b.Results.Count > 0 && b.Results[0].Geometry is MapPoint) { BeginAnimateLocation(b.Results[0].Geometry as MapPoint); } }; ProjectionService.ProjectCompleted += handler; ProjectionService.ProjectAsync(new Graphic[] { new Graphic() { Geometry = geom } }, Map.SpatialReference); } else { EventHandler <Tasks.GraphicsEventArgs> handler = null; handler = (a, b) => { ProjectionService.ProjectCompleted -= handler; UpdateLocation(); //Try again }; ProjectionService.ProjectCompleted += handler; //Wait for task to complete } } return; //Wait for projection to complete } } BeginAnimateLocation(newLocation); } }