Example #1
0
        //Nearby List Methods***********************************************************************************************************************************************************//

        private async void getNearbyStops()
        {
            if (refreshingNearby == false)
            {
                refreshingNearby = true;
                try
                {
                    Geocoordinate myCoordinate = await GeoLocator.getMyLocation();

                    if (myCoordinate != null)
                    {
                        nearbyStops = await OCTranspoStopsData.getCloseStops(myCoordinate.Latitude, myCoordinate.Longitude, currentLocation.ZoomLevel);

                        this.nearbyList.ItemsSource = nearbyStops;
                        setNearbyErrorMessage(true, nearbyStops.Count > 0);
                    }
                    else
                    {
                        nearbySorry.Visibility = nearbyStops.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
                        nearbyFrown.Visibility = nearbyStops.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
                        setNearbyErrorMessage(true, false);
                    }
                }
                catch
                {
                    setNearbyErrorMessage(false, false);
                }
                refreshingNearby = false;
            }
        }
Example #2
0
        public static async void drawMapMarkers(Map map)
        {
            if (map.ZoomLevel > 12)
            {
                map.Layers.Clear();
                MapLayer mapLayer = new MapLayer();
                ObservableCollection <OCStop> stops = await OCTranspoStopsData.getCloseStops(map.Center.Latitude, map.Center.Longitude, map.ZoomLevel);

                foreach (OCStop stop in stops)
                {
                    drawMapMarker(stop, Color.FromArgb(255, 210, 30, 0), mapLayer, true);
                }
                layMyLocation(mapLayer);
                map.Layers.Add(mapLayer);
            }
        }