コード例 #1
0
        public async void AddRoute(bool p)
        {
            Map.Routes.Clear();
            Busy.IsActive = true;
            var routeResult = await MapSourceHandler.UpdatePhone(p);

            Busy.IsActive = false;
            if (!p)
            {
                return;
            }
            if (routeResult == null || routeResult.Status != MapRouteFinderStatus.Success)
            {
                var positions = new List <BasicGeoposition>();
                positions.Add(MapSourceHandler.Kot.Location.Position);
                positions.Add(MapSourceHandler.Phone.Location.Position);
                var box   = GeoboundingBox.TryCompute(positions);
                var kot   = MapSourceHandler.Kot.Location.Position;
                var phone = MapSourceHandler.Phone.Location.Position;
                var nw    = new BasicGeoposition
                {
                    Latitude  = Math.Max(kot.Latitude, phone.Latitude),
                    Longitude = Math.Min(kot.Longitude, phone.Longitude)
                };
                var se = new BasicGeoposition
                {
                    Latitude  = Math.Min(kot.Latitude, phone.Latitude),
                    Longitude = Math.Max(kot.Longitude, phone.Longitude)
                };

                await Map.TrySetViewBoundsAsync(
                    box//new GeoboundingBox(nw, se)
                    , null,
                    MapAnimationKind.Bow);

                return;
            }
            var viewOfRoute = new MapRouteView(routeResult.Route)
            {
                RouteColor   = Color.FromArgb(255, 233, 30, 99),
                OutlineColor = Colors.Transparent
            };

            Map.Routes.Add(viewOfRoute);
            await Map.TrySetViewBoundsAsync(
                routeResult.Route.BoundingBox,
                null,
                MapAnimationKind.Bow);
        }
コード例 #2
0
        private async void UpdateMapElements()
        {
            await MapSourceHandler.GetMapElements();

            if (MapSourceHandler.ServicePoints.Count == 0)
            {
                SetCenterLocation(MapSourceHandler.Kot.Location);
                return;
            }
            var positions = MapSourceHandler.ServicePoints.Select(el => el.Location.Position).ToList();

            positions.Add(MapSourceHandler.Kot.Location.Position);
            var box = GeoboundingBox.TryCompute(positions);

            await Map.TrySetViewBoundsAsync(box, null, MapAnimationKind.Default);

            SetCenterLocation(new Geopoint(box.Center));
        }
コード例 #3
0
 internal async void SendComment()
 {
     await MapSourceHandler.SendComment(UserRate, UserComment);
 }