コード例 #1
0
        private async void SubmitSearchAsync(string tags)
        {
            //notify the user we are thinking
            IsLoading();

            //clear the screen
            Results.Children.Clear();

            //Clear the memory
            CurrentSearch.tiles.Clear();
            CurrentSearch.posts.Clear();

            string last_id = null;

            if (CurrentSearch.posts.Count < 0)
            {
                last_id = CurrentSearch.posts[CurrentSearch.posts.Count - 1].Id.ToString();
            }

            Connection.Arguments = new Dictionary <string, string>
            {
                ["typed_tags"] = "true",
                ["limit"]      = CurrentSearch.ResultsPerRequest.ToString(),
                ["tags"]       = tags,//"rating:s ",
            };
            if (last_id != null)
            {
                Connection.Arguments["last_id"] = last_id;
            }

            int count = await CurrentSearch.UpdateCacheAsync();//.ConfigureAwait(false);

            if (count > 0)
            {
                AddTiles();
            }
            //Add a page worth of Tiles to the UI
            //note 0 results may be caused by an invalid struct cast (aka tryParse() fails)
            //removie the activity indicator
            IsLoading(false);
        }
コード例 #2
0
        //swipe action
        private async void OnSwipeLeft()
        {
            //if Next_post touches the threshhold we have to update the prefetch
            if ((Search.posts.Count - Index) < Search.ResultsPerPage)
            {
                await Search.UpdateCacheAsync();
            }
            Index++;
            Post = Search.posts[Index];

            ReloadMediaPage();
        }