Ejemplo n.º 1
0
        public static void ExecuteGaleryScrape(MainPage mainpage, SynchronizationContext context, ApiUniversal.Parameter.OverviewParameter parameters = null)
        {
            if (parameters == null)
            {
                parameters = new ApiUniversal.Parameter.OverviewParameter();
            }

            context.Post((_) =>
            {
                mainpage.PageDataContext.GalleryItemsLoading = true;

                if (parameters.StartOver)
                {
                    mainpage.PageDataContext.Gallery.Clear();
                }
            }, null);

            parameters.Category = mainpage.PageDataContext.CurrentArticleGallery;

            if (parameters.StartOver)
            {
                mainpage.PageDataContext.GalleryPaging    = 0;
                mainpage.PageDataContext.GalleryItemIndex = 0;
                mainpage.PageDataContext.SelectedGallery  = 0;
            }

            mainpage.PageDataContext.GalleryPaging += 1;
            parameters.Paging = mainpage.PageDataContext.GalleryPaging;

            OverviewExecute oe = new OverviewExecute();

            oe.Parameters = parameters;
            oe.Execute();
            var result = oe.Result;


            context.Post((_) =>
            {
                if (parameters.StartOver)
                {
                    mainpage.PageDataContext.Gallery.Clear();
                }

                foreach (var item in result)
                {
                    item.Index = mainpage.PageDataContext.GalleryItemIndex;
                    mainpage.PageDataContext.Gallery.Add(item);
                    mainpage.PageDataContext.GalleryItemIndex++;
                }

                mainpage.PageDataContext.GalleryItemsLoading = false;
            }, null);
        }
Ejemplo n.º 2
0
        public static void ExecuteGaleryScrape(MainPage mainpage, SynchronizationContext context, ApiUniversal.Parameter.OverviewParameter parameters = null)
        {
            if (parameters == null)
                parameters = new ApiUniversal.Parameter.OverviewParameter();

            context.Post((_) =>
            {
                mainpage.PageDataContext.GalleryItemsLoading = true;

                if (parameters.StartOver)
                    mainpage.PageDataContext.Gallery.Clear();
            }, null);

            parameters.Category = mainpage.PageDataContext.CurrentArticleGallery;

            if (parameters.StartOver)
            {
                mainpage.PageDataContext.GalleryPaging = 0;
                mainpage.PageDataContext.GalleryItemIndex = 0;
                mainpage.PageDataContext.SelectedGallery = 0;
            }
            
            mainpage.PageDataContext.GalleryPaging += 1;
            parameters.Paging = mainpage.PageDataContext.GalleryPaging;

            OverviewExecute oe = new OverviewExecute();
            oe.Parameters = parameters;
            oe.Execute();
            var result = oe.Result;


            context.Post((_) =>
            {
                if (parameters.StartOver)
                {
                    mainpage.PageDataContext.Gallery.Clear();
                }

                foreach (var item in result)
                {
                    item.Index = mainpage.PageDataContext.GalleryItemIndex;
                    mainpage.PageDataContext.Gallery.Add(item);
                    mainpage.PageDataContext.GalleryItemIndex++;
                }

                mainpage.PageDataContext.GalleryItemsLoading = false;
            }, null);
        }
 private async void ShowGallery(ArticleCategory category)
 {
     //Core.Track.Telemetry.Instance.Action("Filter", new Dictionary<string, string>() { { "filter", category.ToString() } });
     PageDataContext.CurrentArticleGallery = category;
     var parameters = new OverviewParameter() { StartOver = true, Category = category, Paging = 0 };
     await Task.Factory.StartNew(() => Searcher.ExecuteGaleryScrape(this, context, parameters), source.Token);
 }