Пример #1
0
        /// <summary>
        /// Get Latest Wallpaper
        /// </summary>
        public async void GetLatestWallpaper()
        {
            HistoryImage historyImage = null;

            try
            {
                historyImage = await _provider.GetLatestImage();

                // 保存到历史记录
                HistoryImageProvider.AddImage(historyImage);
            }
            catch
            {
                historyImage = HistoryImageProvider.getRandom();
            }

            if (historyImage != null)
            {
                Invoke(new Action(async() =>
                {
                    this.CurrentWallpaper = historyImage;
                    await UpdateWallpaper();
                }));
            }
        }
Пример #2
0
        private void UpdateLatestDaysImage()
        {
            var images = IoliuBingCrawler.LoadLatestDaysImages();

            if (images.Count > 0)
            {
                HistoryImageProvider.AddBatch(images);
            }
        }
Пример #3
0
 public async void SetRandomWallpaper()
 {
     try
     {
         CurrentWallpaper = HistoryImageProvider.getRandom();
         await UpdateWallpaper();
     }
     catch { }
 }
Пример #4
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            var pre = HistoryImageProvider.Next(image.Date);

            if (pre != null)
            {
                image = pre;
                WallpaperStoryForm_Load(sender, e);
            }
        }
Пример #5
0
 /// <summary>
 /// Fetch a random Wallpaper from history
 /// </summary>
 public async void SetRandomWallpaper()
 {
     try
     {
         CurrentWallpaper = HistoryImageProvider.getRandom();
         await UpdateWallpaper();
     }
     catch (Exception ex)
     {
         ShowErrorNotification();
     }
 }
Пример #6
0
 public async void PreWallpaper()
 {
     if (CurrentWallpaper != null)
     {
         var newImage = HistoryImageProvider.Previous(this.CurrentWallpaper.Date);
         if (newImage != null)
         {
             this.CurrentWallpaper = newImage;
             await UpdateWallpaper();
         }
     }
 }
Пример #7
0
        private void JumpNext()
        {
            var next = HistoryImageProvider.Next(image.Date);

            if (next != null)
            {
                image = next;
            }
            else
            {
                image = HistoryImageProvider.First();
            }
            LoadImageAsync();
        }
Пример #8
0
        private void JumpPre()
        {
            var pre = HistoryImageProvider.Previous(image.Date);

            if (pre != null)
            {
                image = pre;
            }
            else
            {
                image = HistoryImageProvider.Last();
            }
            LoadImageAsync();
        }
Пример #9
0
        private void UpdateLocalData()
        {
            var images = IoliuBingCrawler.LoadHistoryImages();

            if (images.Count > 0)
            {
                HistoryImageProvider.AddBatch(images);
                MessageBox.Show("更新了 " + images.Count + "条历史数据");
            }
            else
            {
                MessageBox.Show("你的本地数据已经很全啦,未找到新数据!");
            }
        }
Пример #10
0
        private void UpdateLocalData()
        {
            var images = IoliuBingCrawler.LoadHistoryImages();

            if (images.Count > 0)
            {
                HistoryImageProvider.AddBatch(images);
                ShowNotification(Resource.UpdateCount.Replace("{Count}", images.Count.ToString()));
            }
            else
            {
                ShowNotification(Resource.UpdateOver);
            }
        }
Пример #11
0
 public async void PreWallpaper()
 {
     if (CurrentWallpaper != null)
     {
         var newImage = HistoryImageProvider.Previous(CurrentWallpaper.Date);
         if (newImage != null)
         {
             this.CurrentWallpaper = newImage;
             await UpdateWallpaper();
         }
         else
         {
             MessageBox.Show("已经是第一张了\nAlready the first image");
         }
     }
 }
Пример #12
0
        /// <summary>
        /// 随机壁纸
        /// </summary>
        public async void SetRandomWallpaper()
        {
            try
            {
                var bingImg = HistoryImageProvider.getRandom();
                var img     = await bingImg.getImage();

                Wallpaper.Set(img, Wallpaper.Style.Stretched);
                _currentWallpaper = bingImg;
                ShowSetWallpaperNotification();
            }
            catch (Exception ex)
            {
                ShowErrorNotification();
            }
        }
Пример #13
0
        /// <summary>
        /// 获取最新壁纸
        /// </summary>
        public async void SetWallpaper()
        {
            try
            {
                var bingImg = await _provider.GetLatestImage();

                var img = await bingImg.getImage();

                Wallpaper.Set(img, Wallpaper.Style.Stretched);
                _currentWallpaper = bingImg;
                ShowSetWallpaperNotification();

                // 保存到历史记录
                HistoryImageProvider.AddImage(bingImg);
            }
            catch
            {
                ShowErrorNotification();
            }
        }
Пример #14
0
 public async void NextWallpaper()
 {
     if (CurrentWallpaper != null)
     {
         var newImage = HistoryImageProvider.Next(this.CurrentWallpaper.Date);
         if (newImage != null)
         {
             this.CurrentWallpaper = newImage;
             await UpdateWallpaper();
         }
         else
         {
             this.CurrentWallpaper = HistoryImageProvider.First();
             await UpdateWallpaper();
         }
     }
     else
     {
         RandomWallpaper();
     }
 }