Exemplo n.º 1
0
        private static void Main()
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            UserLocation userLocation = GetUserLocation.ReturnUserLocation(GetPostCode());

            List <StopPoint> localStopPoints = GetLocalStopPoints.ReturnStopPoints(userLocation, GetUserMaxDistanceFromStation());

            DisplayAvailableStops(localStopPoints);
            string busStop = localStopPoints[GetBusStop(localStopPoints.Count)].naptanId;

            List <Arrival> arrivals = GetArrivals.ReturnArrivals(busStop);

            arrivals = arrivals.OrderBy(n => n.ExpectedArrival).ToList();

            Console.WriteLine();
            DisplayArrivals(arrivals);

            Console.ReadLine();
        }
Exemplo n.º 2
0
        async private void LocationMap_CameraIdled(object sender, CameraIdledEventArgs e)
        {
            var pos = e.Position.Target;
            var loc = new Location(pos.Latitude, pos.Longitude);
            var x   = await GetUserLocation.GetAddress(loc);

            if (x?.Data != null)
            {
                Place.Location           = loc;
                Place.Placemark          = x.Data;
                Place.LocationAddress    = LocationAddress.GetLocationString(x.Data);
                CurrentLocationText.Text = LocationAddress.GetLocationString(x.Data);
            }
            else
            {
                Place.Location           = loc;
                Place.Placemark          = null;
                Place.LocationAddress    = "Unnamed";
                CurrentLocationText.Text = "Unnamed";
            }
        }
Exemplo n.º 3
0
        async public static Task <BaseModel <Place> > SelectPlace()
        {
            var currentNav = Application.Current.MainPage.Navigation;

            if (currentNav != null)
            {
                var result      = new BaseModel <Place>();
                var placePicker = new LocationPicker();
                var Status      = await GetUserLocation.CheckPermissions();

                if (Status == Status.Success)
                {
                    if (currentNav.ModalStack.Where(x => x is LocationPicker).Count() == 0)
                    {
                        await currentNav.PushModalAsync(placePicker);

                        var selectedPlace = await placePicker.GetPlace();

                        result.Data   = selectedPlace;
                        result.Status = Status.Success;
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    result.Status = Status;
                }
                return(result);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        private List <StopPoint> GetLocalStops(string postCode, string maxDistance)
        {
            UserLocation userLocation = GetUserLocation.ReturnUserLocation(postCode);

            return(GetLocalStopPoints.ReturnStopPoints(userLocation, maxDistance));
        }