/// <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(); })); } }
private void UpdateLatestDaysImage() { var images = IoliuBingCrawler.LoadLatestDaysImages(); if (images.Count > 0) { HistoryImageProvider.AddBatch(images); } }
public async void SetRandomWallpaper() { try { CurrentWallpaper = HistoryImageProvider.getRandom(); await UpdateWallpaper(); } catch { } }
private void btnNext_Click(object sender, EventArgs e) { var pre = HistoryImageProvider.Next(image.Date); if (pre != null) { image = pre; WallpaperStoryForm_Load(sender, e); } }
/// <summary> /// Fetch a random Wallpaper from history /// </summary> public async void SetRandomWallpaper() { try { CurrentWallpaper = HistoryImageProvider.getRandom(); await UpdateWallpaper(); } catch (Exception ex) { ShowErrorNotification(); } }
public async void PreWallpaper() { if (CurrentWallpaper != null) { var newImage = HistoryImageProvider.Previous(this.CurrentWallpaper.Date); if (newImage != null) { this.CurrentWallpaper = newImage; await UpdateWallpaper(); } } }
private void JumpNext() { var next = HistoryImageProvider.Next(image.Date); if (next != null) { image = next; } else { image = HistoryImageProvider.First(); } LoadImageAsync(); }
private void JumpPre() { var pre = HistoryImageProvider.Previous(image.Date); if (pre != null) { image = pre; } else { image = HistoryImageProvider.Last(); } LoadImageAsync(); }
private void UpdateLocalData() { var images = IoliuBingCrawler.LoadHistoryImages(); if (images.Count > 0) { HistoryImageProvider.AddBatch(images); MessageBox.Show("更新了 " + images.Count + "条历史数据"); } else { MessageBox.Show("你的本地数据已经很全啦,未找到新数据!"); } }
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); } }
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"); } } }
/// <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(); } }
/// <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(); } }
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(); } }