private async void OnZoomClick(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Initiate task to zoom both map views in. Task t1 = MyMapViewTop.SetViewpointAsync(_zoomInPoint, TimeSpan.FromSeconds(5)); Task t2 = MyMapViewBottom.SetViewpointAsync(_zoomInPoint, TimeSpan.FromSeconds(5)); await Task.WhenAll(t1, t2); // Delay start of next set of zoom tasks. await Task.Delay(2000); // Initiate task to zoom both map views out. Task t3 = MyMapViewTop.SetViewpointAsync(_zoomOutPoint, TimeSpan.FromSeconds(5)); Task t4 = MyMapViewBottom.SetViewpointAsync(_zoomOutPoint, TimeSpan.FromSeconds(5)); await Task.WhenAll(t3, t4); }
private async void OnZoomClick(object sender, EventArgs e) { try { // Initiate task to zoom both map views in. Task t1 = MyMapViewTop.SetViewpointAsync(_zoomInPoint, TimeSpan.FromSeconds(5)); Task t2 = MyMapViewBottom.SetViewpointAsync(_zoomInPoint, TimeSpan.FromSeconds(5)); await Task.WhenAll(t1, t2); // Delay start of next set of zoom tasks. await Task.Delay(2000); // Initiate task to zoom both map views out. Task t3 = MyMapViewTop.SetViewpointAsync(_zoomOutPoint, TimeSpan.FromSeconds(5)); Task t4 = MyMapViewBottom.SetViewpointAsync(_zoomOutPoint, TimeSpan.FromSeconds(5)); await Task.WhenAll(t3, t4); } catch (Exception ex) { await((Page)Parent).DisplayAlert("Error", ex.ToString(), "OK"); } }
private void Initialize() { // Set the top map to render all features in static rendering mode MyMapViewTop.Map.LoadSettings.PreferredPointFeatureRenderingMode = FeatureRenderingMode.Static; MyMapViewTop.Map.LoadSettings.PreferredPolylineFeatureRenderingMode = FeatureRenderingMode.Static; MyMapViewTop.Map.LoadSettings.PreferredPolygonFeatureRenderingMode = FeatureRenderingMode.Static; // Set the bottom map to render all features in dynamic rendering mode MyMapViewBottom.Map.LoadSettings.PreferredPointFeatureRenderingMode = FeatureRenderingMode.Dynamic; MyMapViewBottom.Map.LoadSettings.PreferredPolylineFeatureRenderingMode = FeatureRenderingMode.Dynamic; MyMapViewBottom.Map.LoadSettings.PreferredPolygonFeatureRenderingMode = FeatureRenderingMode.Dynamic; // Create service feature table using a point, polyline, and polygon service. ServiceFeatureTable pointServiceFeatureTable = new ServiceFeatureTable(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/0")); ServiceFeatureTable polylineServiceFeatureTable = new ServiceFeatureTable(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/8")); ServiceFeatureTable polygonServiceFeatureTable = new ServiceFeatureTable(new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9")); // Create feature layer from service feature tables. FeatureLayer pointFeatureLayer = new FeatureLayer(pointServiceFeatureTable); FeatureLayer polylineFeatureLayer = new FeatureLayer(polylineServiceFeatureTable); FeatureLayer polygonFeatureLayer = new FeatureLayer(polygonServiceFeatureTable); // Add each layer to top map. MyMapViewTop.Map.OperationalLayers.Add(pointFeatureLayer.Clone()); MyMapViewTop.Map.OperationalLayers.Add(polylineFeatureLayer.Clone()); MyMapViewTop.Map.OperationalLayers.Add(polygonFeatureLayer.Clone()); // Add each layer to top map. MyMapViewBottom.Map.OperationalLayers.Add(pointFeatureLayer); MyMapViewBottom.Map.OperationalLayers.Add(polylineFeatureLayer); MyMapViewBottom.Map.OperationalLayers.Add(polygonFeatureLayer); // Set the view point of both MapViews. MyMapViewTop.SetViewpoint(_zoomOutPoint); MyMapViewBottom.SetViewpoint(_zoomOutPoint); }