Exemple #1
0
        private void Map_Hold(object sender, System.Windows.Input.GestureEventArgs e)
        {
            GeoCoordinate location;
            bool          canConvert = (sender as Map).TryViewportPointToLocation(e.GetPosition(sender as Map), out location);

            VibrateController.Default.Start(TimeSpan.FromMilliseconds(250));

            if (canConvert)
            {
                PointOnMapMessage.Send(Coordinate.FromGeoCoordinate(location));
            }
        }
Exemple #2
0
        private void SelectPointOnMap(PointOnMapMessage action)
        {
            switch (action.Reason)
            {
            case PointOnMapMessageReason.PublicStopPoint:
                SelectedStation = UnitOfWork.PublicStopRepository.FindById(action.PublicStopPoint.PublicStopId);
                break;

            case PointOnMapMessageReason.PlaceOfInterest:
                SelectedSearchResult = action.PlaceOfInterest;
                break;

            case PointOnMapMessageReason.CustomPoint:
                cancellationTokenSource.Cancel();
                cancellationTokenSource = new CancellationTokenSource();

                ShowHeaderLoader();

                Action search = async() =>
                {
                    try
                    {
                        Address customAddress = await BumbleApiService.ReverseGeoCode(cancellationTokenSource.Token, user, action.Coordinate);

                        int distance = 0;

                        if (user.LastKnownGeneralLocation != null)
                        {
                            distance = (int)action.Coordinate.DistanceToCoordinateInMetres(user.LastKnownGeneralLocation);
                        }

                        SelectedCustomPoint = new Entities.PlaceOfInterest(customAddress.AddressText, null, customAddress.AddressText, action.Coordinate, distance);
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message != AppResources.ApiErrorTaskCancelled)
                        {
                            base.ShowPopup(CustomPopupMessageType.Error, ex.Message, AppResources.CustomPopupGenericOkMessage, null);
                        }
                    }

                    HideHeaderLoader();
                };

                DispatcherHelper.CheckBeginInvokeOnUI(search);
                break;
            }
        }
Exemple #3
0
 private void SelectPointOnMap()
 {
     PointOnMapMessage.Send(this);
 }
        private void SelectPointOnMap(PointOnMapMessage action)
        {
            switch (action.Reason)
            {
                case PointOnMapMessageReason.PublicStopPoint:
                    SelectedStation = UnitOfWork.PublicStopRepository.FindById(action.PublicStopPoint.PublicStopId);
                    break;
                case PointOnMapMessageReason.PlaceOfInterest:
                    SelectedSearchResult = action.PlaceOfInterest;
                    break;
                case PointOnMapMessageReason.CustomPoint:
                    cancellationTokenSource.Cancel();
                    cancellationTokenSource = new CancellationTokenSource();

                    ShowHeaderLoader();

                    Action search = async () =>
                    {
                        try
                        {
                            Address customAddress = await BumbleApiService.ReverseGeoCode(cancellationTokenSource.Token, user, action.Coordinate);

                            int distance = 0;

                            if (user.LastKnownGeneralLocation != null)
                                distance = (int)action.Coordinate.DistanceToCoordinateInMetres(user.LastKnownGeneralLocation);

                            SelectedCustomPoint = new Entities.PlaceOfInterest(customAddress.AddressText, null, customAddress.AddressText, action.Coordinate, distance);

                        }
                        catch (Exception ex)
                        {
                            if (ex.Message != AppResources.ApiErrorTaskCancelled)
                            {
                                base.ShowPopup(CustomPopupMessageType.Error, ex.Message, AppResources.CustomPopupGenericOkMessage, null);
                            }
                        }

                        HideHeaderLoader();
                    };

                    DispatcherHelper.CheckBeginInvokeOnUI(search);
                    break;
            }
        }