/// <summary>
        /// Handles clicks to set waypoint as departure point
        /// </summary>
        private void SetDepartureWaypoint_Click(object sender, RoutedEventArgs e)
        {
            var location = ((MenuFlyoutItem)sender).DataContext as LocationData;

            RouteWaypoints.Insert(0, location);
            RouteDirectionSplitView.IsPaneOpen = true;
        }
        /// <summary>
        /// Handles clicks to the Show Route button and display
        /// the route to the selected location from the user's current position.
        /// </summary>
        private void ShowRouteButton_Click(object sender, RoutedEventArgs e)
        {
            var location = GetLocation(sender as Button);

            RouteWaypoints.Clear();
            RouteWaypoints.Insert(0, MappedLocations[0]);
            RouteWaypoints.Add(location);

            RouteDirectionSplitView.IsPaneOpen = true;
        }
        /// <summary>
        /// Updates the UI to account for the user's current position, if available,
        /// resetting the MapControl bounds and refreshing the travel info.
        /// </summary>
        /// <param name="isGeolocatorReady">false if the Geolocator is known to be unavailable; otherwise, true.</param>
        /// <returns></returns>
        private async Task ResetViewAsync(bool isGeolocatorReady = true)
        {
            LocationData currentLocation = null;

            if (isGeolocatorReady)
            {
                currentLocation = await GetCurrentLocationAsync();
            }

            if (currentLocation != null)
            {
                if (MappedLocations.Count > 0 && MappedLocations[0].IsCurrentLocation)
                {
                    MappedLocations.RemoveAt(0);
                }

                await LocationHelper.TryUpdateMissingLocationInfoAsync(currentLocation, "Current Location");

                MappedLocations.Insert(0, new LocationData {
                    Name = "Current Location", Position = currentLocation.Position, IsCurrentLocation = true
                });
                RouteWaypoints.Insert(0, currentLocation);
            }

            // Set the current view of the map control.
            var positions = Locations.Select(loc => loc.Position).ToList();

            if (currentLocation != null)
            {
                positions.Insert(0, currentLocation.Position);
            }

            if (positions.Count > 0)
            {
                bool isSuccessful = await SetViewBoundsAsync(positions);

                if (isSuccessful && positions.Count < 2)
                {
                    MyMap.ZoomLevel = 15;
                }
                else if (!isSuccessful && positions.Count > 0)
                {
                    MyMap.Center    = new Geopoint(positions[0]);
                    MyMap.ZoomLevel = 15;
                }
            }
        }