private void openPopup(IMapControl page, PlanItemPopupModel popupModel, bool downside = false) { var popupContent = new PlanItemPopup(page); popupContent.SetModel(popupModel); openedPopupLayers.Add(popupContent); AddControlToMap(popupContent, popupModel.Stop.Coordinate, new Point(0.5, downside ? 0 : 1)); }
private void PutStopCircle(MapPage page, Route route, Stop stop, TimeSpan time, int stopCount, PlanItemPopupType type, double walkBeforeMeters = 0.0) { MapLayer mapLayer = new MapLayer(); var content = new Ellipse { Fill = route.RouteGroup.GetColors().PrimaryColorBrush, Stroke = route.RouteGroup.GetColors().MainColorBrush, StrokeThickness = 3, Width = 26, Height = 26 }; mapLayer.Add(new MapOverlay() { GeoCoordinate = Convert(stop.Coordinate), PositionOrigin = new Point(0.5, 0.5), Content = content }); page.Map.Layers.Add(mapLayer); var model = new PlanItemPopupModel { Time = time, Stop = stop, Route = route, StopCount = stopCount, Type = type }; mapItems.Add(model); tapActions[content] = delegate { closePopups(page); int index = mapItems.IndexOf(model); if (index == 0 || index == mapItems.Count - 1) { openPopup(page, model); } else { int pairIndex = index % 2 == 0 ? index - 1 : index + 1; var pairModel = mapItems[pairIndex]; bool isDownside = model.Stop.Latitude < pairModel.Stop.Latitude; openPopup(page, model, isDownside); openPopup(page, pairModel, !isDownside); } }; }
private void openPopup(MapPage page, PlanItemPopupModel popupModel, bool downside = false) { var popupContent = new PlanItemPopup(); popupContent.SetModel(popupModel); MapLayer popupLayer = new MapLayer(); popupLayer.Add(new MapOverlay() { GeoCoordinate = Convert(popupModel.Stop.Coordinate), PositionOrigin = new Point(0.5, downside ? 0 : 1), Content = popupContent }); openedPopupLayers.Add(popupLayer); page.Map.Layers.Add(popupLayer); }
private void PutStopCircle(IMapControl page, Route route, Stop stop, TimeSpan time, int stopCount, PlanItemPopupType type, double walkBeforeMeters = 0.0) { var content = base.CreateColoredCircle( route.RouteGroup.GetColors().PrimaryColorBrush, route.RouteGroup.GetColors().MainColorBrush, route.RouteGroup.GetColors().SecondaryColorBrush ); AddControlToMap(content, stop.Coordinate); var model = new PlanItemPopupModel { Time = time, Stop = stop, Route = route, StopCount = stopCount, Type = type }; mapItems.Add(model); tapActions[content] = delegate { closePopups(page); int index = mapItems.IndexOf(model); if (index == 0 || index == mapItems.Count - 1) { openPopup(page, model); } else { int pairIndex = index % 2 == 0 ? index - 1 : index + 1; var pairModel = mapItems[pairIndex]; bool isDownside = model.Stop.Latitude < pairModel.Stop.Latitude; openPopup(page, model, isDownside); openPopup(page, pairModel, !isDownside); } }; }