Пример #1
0
        public void ShowNearStations()
        {
            if (CurrentCity.Stations == null)
            {
                return;
            }

            CurrentCity.FromNearStations = BikeConsts.GetNearStations(CurrentCity.From, CurrentCity.Stations, true);
            //this.map.SetView(CurrentCity.From, BikeConsts.ZOOM_DETAIL);
        }
Пример #2
0
        public void GeocodeForDirectionsCompleted(object sender, GeocodeCompletedEventArgs e)
        {
            if (e.Result.ResponseSummary.StatusCode != ResponseStatusCode.Success)
            {
                IsMessage = true;
                Message   = AppResources.Message_AddressNotFound;
                return;
            }

            if (e.Result.Results.Count == 0 || e.Result.Results[0].Locations.Count == 0)
            {
                IsMessage = true;
                Message   = AppResources.Message_AddressNotFound;
                return;
            }

            //set the destination place
            CurrentCity.To = e.Result.Results[0].Locations[0];


            //retrieve the stations arround destination place
            CurrentCity.ToNearStations = BikeConsts.GetNearStations(CurrentCity.To, CurrentCity.Stations, false);

            //if there was any station before selected than i can compute directions
            if (CurrentCity.CurrentStation != null)
            {
                var routes = new ObservableCollection <BikeRouteViewModel>();


                foreach (var finish in CurrentCity.ToNearStations)
                {
                    BikeRouteViewModel route = new BikeRouteViewModel();
                    route.From = CurrentCity.CurrentStation;
                    route.To   = finish;
                    route.CalculateRoute();
                    routes.Add(route);
                }

                CurrentCity.Routes = routes;
            }
        }