public QueryTourisViewModel(ITouristPoints serviceAgent) { IsEnabled = false; this.serviceAgent = serviceAgent; Task.Run((async() => { TouristCollection = await serviceAgent.GetTouristsLocations(); AllTouristCollection = new List <Tourist>(touristCollection); IsEnabled = true; })); }
private async void CreateGraphics() { TouristsList = await touristAgent.GetTouristsLocations(); double xMin = 999; double yMin = 999; double xMax = 0; double yMax = 0; for (var n = 0; n < TouristsList.Count; ++n) { var item = TouristsList[n]; var symbol = (touristAgent as IRenderGraphic).CreatSymbol <PictureMarkerSymbol>(new Uri(Global.LocalMarkerUrl)); var graphic = (touristAgent as IRenderGraphic).CreateGraphic(n, symbol, item); double x = (double)item.Point.longitude; double y = (double)item.Point.latitude; if (x < xMin) { xMin = x; } else if (x > xMax) { xMax = x; } if (y < yMin) { yMin = y; } else if (y > yMax) { yMax = y; } _graphicsLayer.Graphics.Add(graphic); } var minPoint = new MapPoint(xMin, yMin, SpatialReferences.Wgs84); var maxPoint = new MapPoint(xMax, yMax, SpatialReferences.Wgs84); Envelope envelope = new Envelope(minPoint, maxPoint);//xMin, yMin, xMax, yMax //var currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry); //var viewpointExtent = currentViewpoint.TargetGeometry.Extent; await MyMapView.SetViewAsync(envelope.Expand(1.10)); }