コード例 #1
0
        private void SetPoint(MapPointMessage message)
        {
            ShowHeaderLoader();

            cancellationTokenSource.Cancel();
            cancellationTokenSource = new CancellationTokenSource();

            Point           = message.Point.GeoCoordinate;
            PointVisibility = Visibility.Visible;

            FooterBarVisibility = Visibility.Collapsed;

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

                    SelectedCustomPoint = new Entities.PlaceOfInterest(customAddress.AddressText, null, customAddress.ShortAddressText, message.Point, -1);

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

                HideHeaderLoader();
            };

            DispatcherHelper.CheckBeginInvokeOnUI(search);
        }
コード例 #2
0
        public void SetAsCustomPoint(Entities.PlaceOfInterest customPoint)
        {
            this.Station     = null;
            this.SearchItem  = null;
            this.CustomPoint = customPoint;

            RaisePropertyChanged("Location");
        }
コード例 #3
0
        public void SetAsStation(PublicStop station)
        {
            this.Station     = station;
            this.SearchItem  = null;
            this.CustomPoint = null;

            RaisePropertyChanged("Location");
        }
コード例 #4
0
        public void ClearValues()
        {
            this.Station     = null;
            this.SearchItem  = null;
            this.CustomPoint = null;

            this.Hide();
        }
コード例 #5
0
        public void SetAsPlaceOfInterest(Entities.PlaceOfInterest searchItem)
        {
            this.Station = null;
            this.CustomPoint = null;
            this.SearchItem = searchItem;

            RaisePropertyChanged("Location");
        }
コード例 #6
0
        public void SetAsStation(PublicStop station)
        {
            this.Station = station;
            this.SearchItem = null;
            this.CustomPoint = null;

            RaisePropertyChanged("Location");
        }
コード例 #7
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;
            }
        }
コード例 #8
0
        protected override void PageLoaded()
        {
            base.PageLoaded();

            Register();

            searchType = SimpleIoc.Default.GetInstance <SearchTypeModel>().SearchType;

            if (searchType == SearchType.Location)
            {
                PageTitleMessage.Send(AppResources.HeaderChooseLocation);
            }
            else
            {
                PageTitleMessage.Send(AppResources.HeaderChooseDestination);
            }

            if (SimpleIoc.Default.IsRegistered <SearchItem>())
            {
                SearchItem searchItem = SimpleIoc.Default.GetInstance <SearchItem>();

                MapCenterPoint      = searchItem.Location.GeoCoordinate;
                MapZoomLevel        = 15;
                Point               = searchItem.Location.GeoCoordinate;
                SelectedCustomPoint = new Entities.PlaceOfInterest(searchItem.Name, null, searchItem.Description, searchItem.Location, (int)searchItem.Distance);

                PointVisibility     = Visibility.Visible;
                FooterBarVisibility = Visibility.Visible;

                SimpleIoc.Default.Unregister <SearchItem>();
            }
            else
            {
                PointVisibility     = Visibility.Collapsed;
                FooterBarVisibility = Visibility.Collapsed;

                if (this.user.LastKnownGeneralLocation.IsValid())
                {
                    MapCenterPoint         = this.user.LastKnownGeneralLocation.GeoCoordinate;
                    MapZoomLevel           = 15;
                    UserLocation           = this.user.LastKnownGeneralLocation.GeoCoordinate;
                    UserLocationVisibility = Visibility.Visible;
                }
            }
        }
コード例 #9
0
        protected override void PageLoaded()
        {
            base.PageLoaded();

            Register();

            searchType = SimpleIoc.Default.GetInstance<SearchTypeModel>().SearchType;

            if (searchType == SearchType.Location)
                PageTitleMessage.Send(AppResources.HeaderChooseLocation);
            else
                PageTitleMessage.Send(AppResources.HeaderChooseDestination);

            if (SimpleIoc.Default.IsRegistered<SearchItem>())
            {
                SearchItem searchItem = SimpleIoc.Default.GetInstance<SearchItem>();

                MapCenterPoint = searchItem.Location.GeoCoordinate;
                MapZoomLevel = 15;
                Point = searchItem.Location.GeoCoordinate;
                SelectedCustomPoint = new Entities.PlaceOfInterest(searchItem.Name, null, searchItem.Description, searchItem.Location, (int) searchItem.Distance);

                PointVisibility = Visibility.Visible;
                FooterBarVisibility = Visibility.Visible;

                SimpleIoc.Default.Unregister<SearchItem>();
            }
            else
            {
                PointVisibility = Visibility.Collapsed;
                FooterBarVisibility = Visibility.Collapsed;

                if (this.user.LastKnownGeneralLocation.IsValid())
                {
                    MapCenterPoint = this.user.LastKnownGeneralLocation.GeoCoordinate;
                    MapZoomLevel = 15;
                    UserLocation = this.user.LastKnownGeneralLocation.GeoCoordinate;
                    UserLocationVisibility = Visibility.Visible;
                }
            }
        }
コード例 #10
0
        private void SetPoint(MapPointMessage message)
        {
            ShowHeaderLoader();

            cancellationTokenSource.Cancel();
            cancellationTokenSource = new CancellationTokenSource();

            Point = message.Point.GeoCoordinate;
            PointVisibility = Visibility.Visible;

            FooterBarVisibility = Visibility.Collapsed;

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

                    SelectedCustomPoint = new Entities.PlaceOfInterest(customAddress.AddressText, null, customAddress.ShortAddressText, message.Point, -1);

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

                HideHeaderLoader();
            };

            DispatcherHelper.CheckBeginInvokeOnUI(search);
        }
コード例 #11
0
 public static void Send(Entities.PlaceOfInterest placeOfInterest)
 {
     new PointOnMapMessage(placeOfInterest).Send();
 }
コード例 #12
0
 public PointOnMapMessage(Entities.PlaceOfInterest placeOfInterest)
 {
     this.PlaceOfInterest = placeOfInterest;
     this.Reason          = PointOnMapMessageReason.PlaceOfInterest;
 }
コード例 #13
0
        public void ClearValues()
        {
            this.Station = null;
            this.SearchItem = null;
            this.CustomPoint = null;

            this.Hide();
        }
コード例 #14
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;
            }
        }