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); }
public void SetAsCustomPoint(Entities.PlaceOfInterest customPoint) { this.Station = null; this.SearchItem = null; this.CustomPoint = customPoint; RaisePropertyChanged("Location"); }
public void SetAsStation(PublicStop station) { this.Station = station; this.SearchItem = null; this.CustomPoint = null; RaisePropertyChanged("Location"); }
public void ClearValues() { this.Station = null; this.SearchItem = null; this.CustomPoint = null; this.Hide(); }
public void SetAsPlaceOfInterest(Entities.PlaceOfInterest searchItem) { this.Station = null; this.CustomPoint = null; this.SearchItem = searchItem; RaisePropertyChanged("Location"); }
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; } }
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; } } }
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; } } }
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); }
public static void Send(Entities.PlaceOfInterest placeOfInterest) { new PointOnMapMessage(placeOfInterest).Send(); }
public PointOnMapMessage(Entities.PlaceOfInterest placeOfInterest) { this.PlaceOfInterest = placeOfInterest; this.Reason = PointOnMapMessageReason.PlaceOfInterest; }
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; } }