protected override void PageUnloaded() { base.PageUnloaded(); PlacesOfInterest.Clear(); poiCategories = null; }
private void MapButton() { if (PlacesOfInterest.Count() == 0) { base.ShowPopup(CustomPopupMessageType.Information, AppResources.PlacesOfInterestNoMapResultsPopupText, AppResources.CustomPopupGenericOkMessage, null); return; } ShowMap(); }
private void TimerTickSearch(object sender, EventArgs e) { timerSearch.Stop(); cancellationTokenSource.Cancel(); cancellationTokenSource = new CancellationTokenSource(); HideNoResults(); ShowLoader(); Action search = async() => { try { PlacesOfInterest.Clear(); IEnumerable <Entities.PlaceOfInterest> results; if (locationIsAllowed && user.LastKnownGeneralLocation != null && user.LastKnownGeneralLocation.IsValid()) { results = await BumbleApiService.PlacesOfInterest(cancellationTokenSource.Token, user, SearchText, null); } else { results = await BumbleApiService.PlacesOfInterest(cancellationTokenSource.Token, user, SearchText, null); } PlacesOfInterest.AddRange(results.Where(x => poiCategories.Where(z => z.IsChecked).Select(y => y.Category).Contains(x.PlaceOfInterestCategory.Category))); HideLoader(); if (PlacesOfInterest.Count() == 0) { ShowNoResults(); } base.AddFeatureUse(PageUseType.TextBox, string.Format("Searched for [{0}]", searchText)); } catch (Exception ex) { if (ex.Message != AppResources.ApiErrorTaskCancelled) { base.ShowPopup(CustomPopupMessageType.Error, ex.Message, AppResources.CustomPopupGenericOkMessage, null); base.AddFeatureUse(PageUseType.Error, string.Format("Error while searching. Reason: {0}", ex.Message)); HideLoader(); ShowNoResults(); ClearSearchTextBox(); } } }; DispatcherHelper.CheckBeginInvokeOnUI(search); }