private void ZoomToData() { if (HasRoute) { //Zoom to the route with a bit of a buffer around it RequestViewpoint?.Invoke(this, new Viewpoint(GeometryEngine.Buffer(Overlays[0].Extent, Math.Max(Overlays[0].Extent.Width, Overlays[0].Extent.Height) * .25))); } else if (Overlays[1].Graphics[0].Geometry != null && Overlays[1].Graphics[1].Geometry != null) { //Zoom to the two geocoded locations RequestViewpoint?.Invoke(this, new Viewpoint(GeometryEngine.Buffer(Overlays[1].Extent, Math.Max(Overlays[1].Extent.Width, Overlays[1].Extent.Height) * .25))); } else if (Overlays[1].Graphics[0].Geometry != null) { //Zoom to from-location RequestViewpoint?.Invoke(this, new Viewpoint(Overlays[1].Graphics[0].Geometry as MapPoint, 400)); } else if (Overlays[1].Graphics[1].Geometry != null) { //Zoom to to-location RequestViewpoint?.Invoke(this, new Viewpoint(Overlays[1].Graphics[1].Geometry as MapPoint, 400)); } }
private async void DoStartupZoomIn() { await Task.Delay(1000); RequestViewpoint?.Invoke(this, new Viewpoint(new MapPoint(-13046209, 4036456, SpatialReferences.WebMercator), 3000)); }