Exemplo n.º 1
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        public async void Update()
        {
            IsLoading = true;
            LatestThemeStories lts = await _api.GetLatestThemeStories(_theme_id);

            if (lts != null)
            {
                Title           = lts.Name;
                Description     = lts.Description;
                BackImage       = lts.Image;
                BackImageSource = !lts.Image_Source.Equals("") ? "from " + lts.Image_Source : "";


                ThemeStoriesIncrementalLoadingCollection c = new ThemeStoriesIncrementalLoadingCollection(lts.Stories.Last().ID, _theme_id);
                lts.Stories.ToList().ForEach((s) =>
                {
                    if (DataShareManager.Current.FavoriteList.Contains(s.ID))
                    {
                        s.Favorite = true;
                    }
                    if (DataShareManager.Current.ReadedList.Contains(s.ID))
                    {
                        s.Readed = true;
                    }
                    c.Add(s);
                });

                Stories = c;
                Editors = lts.Editors;

                c.DataLoaded  += C_DataLoaded;
                c.DataLoading += C_DataLoading;
            }
            IsLoading = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        public async void Update()
        {
            IsLoading = true;
            LatestThemeStories lts = await _api.GetLatestThemeStories(_theme_id);
            if (lts != null)
            {
                Title = lts.Name;
                Description = lts.Description;
                BackImage = lts.Image;
                BackImageSource = !lts.Image_Source.Equals("") ? "from " + lts.Image_Source : "";


                ThemeStoriesIncrementalLoadingCollection c = new ThemeStoriesIncrementalLoadingCollection(lts.Stories.Last().ID, _theme_id);
                lts.Stories.ToList().ForEach((s) =>
                {
                    if (DataShareManager.Current.FavoriteList.Contains(s.ID))
                    {
                        s.Favorite = true;
                    }
                    if (DataShareManager.Current.ReadedList.Contains(s.ID))
                    {
                        s.Readed = true;
                    }
                    c.Add(s);
                });

                Stories = c;
                Editors = lts.Editors;

                c.DataLoaded += C_DataLoaded;
                c.DataLoading += C_DataLoading;
            }
            IsLoading = false;
        }