Пример #1
0
 public void RunLoadMore()
 {
     RecentSearches.Clear();
     TopItems.Clear();
     GetDynamicSearches();
     GetRecentSearches();
 }
 private void LoadRecentSearches()
 {
     RecentSearches.Clear();
     foreach (var listing in _state.RecentSearches)
     {
         RecentSearches.Add(listing);
     }
 }
Пример #3
0
        public async void GetRecentSearches()
        {
            try
            {
                RecentSearchesAdded = false;
                Views.Searches.SearchView.Current?.ShowTopLoadingTop();
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    var result = await InstaApi.DiscoverProcessor.GetRecentSearchesAsync();
                    if (result.Succeeded)
                    {
                        AccountSearchesPrivate.Clear();
                        HashtagSearchesPrivate.Clear();
                        AccountSearches.Clear();
                        RecentSearches.Clear();
                        RecentSearches.AddRange(result.Value.Recent);
                        if (TopItems.Count > 0)
                        {
                            AddRecentSearches();
                            if (result.Value.Recent.Count > 0)
                            {
                                var xxx = result.Value.Recent.Where(a => !a.IsHashtag).Select(b => b.User).ToList();
                                xxx.ForEach(tx => AccountSearchesPrivate.Add(tx.ToUser()));
                                AccountSearches.AddRange(AccountSearchesPrivate);
                            }
                            if (result.Value.Recent.Count > 0)
                            {
                                var xxx = result.Value.Recent.Where(a => a.IsHashtag).Select(b => b.Hashtag.ToHashtag()).ToList();
                                xxx.ForEach(tx => HashtagSearchesPrivate.Add(tx));
                                HashtagSearches.AddRange(HashtagSearchesPrivate);
                            }
                        }
                    }

                    Views.Searches.SearchView.Current?.HideTopLoadingTop();
                });
            }
            catch { Views.Searches.SearchView.Current?.HideTopLoadingTop(); }
        }