public async Task LoadWallpapers()
        {
            if (IsLoadingWallpaper || SelectedTag == null || SelectedSort == null)
            {
                return;
            }

            IsLoadingWallpaper = true;

            if (Wallpapers == null)
            {
                Wallpapers = new ObservableCollection <WallpaperServerObj>();
            }
            else if (_pageIndex == 1)
            {
                Wallpapers.Clear();
            }

            var tempList = await _localServer.GetWallpapers(SelectedTag.ID, SelectedSort.ID, _pageIndex ++);

            if (tempList == null)
            {
                return;
            }

            tempList.ForEach(m => Wallpapers.Add(m));

            IsLoadingWallpaper = false;
        }
Exemple #2
0
        public async void LoadWallpapers()
        {
            if (_pageIndex >= 1 && !unlocked)
            {
                MessageBox.Show(GeneralSetting.TipMessage);
                return;
            }
            if (SelectedTag == null || SelectedSort == null)
            {
                return;
            }

            if (Wallpapers == null)
            {
                Wallpapers = new List <WallpaperServerObj>();
            }

            IsBusy = true;
            var tempList = await _localServer.GetWallpapers(SelectedTag.ID, SelectedSort.ID, _pageIndex ++);

            IsBusy = false;

            if (tempList == null)
            {
                return;
            }

            var newList = new List <WallpaperServerObj>(Wallpapers);

            newList.AddRange(tempList);
            Wallpapers = new List <WallpaperServerObj>(newList);
            //NotifyOfPropertyChange(WallpapersPropertyName);
            //tempList.ForEach(m => Wallpapers.Add(m));
        }
Exemple #3
0
        public async Task <ReadOnlyCollection <WallpaperServerObj> > LoadWallpapers()
        {
            if (SelectedTag == null || SelectedSort == null)
            {
                return(null);
            }

            var service = IoC.Get <AppService>();

            if (_pageIndex >= 2 && AppService.IsLocked(service.Setting.Server.ServerUrl))
            {
#pragma warning disable UWP003 // UWP-only
                MessageDialog msg = new MessageDialog("更多壁纸请加群 641405255 免费解锁");
#pragma warning restore UWP003 // UWP-only
                var result = await msg.ShowAsync();

                return(null);
            }

            if (Wallpapers == null)
            {
                Wallpapers = new List <WallpaperServerObj>();
            }
            else if (_pageIndex == 1)
            {
                Wallpapers.Clear();
            }

            var tempList = await _localServer.GetWallpapers(SelectedTag.ID, SelectedSort.ID, _pageIndex ++);

            if (tempList == null)
            {
                return(null);
            }

            tempList.ForEach(m => Wallpapers.Add(m));

            return(new ReadOnlyCollection <WallpaperServerObj>(Wallpapers));
        }