/// <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(); })); } }
public async void SetRandomWallpaper() { try { CurrentWallpaper = HistoryImageProvider.getRandom(); await UpdateWallpaper(); } catch { } }
/// <summary> /// Fetch a random Wallpaper from history /// </summary> public async void SetRandomWallpaper() { try { CurrentWallpaper = HistoryImageProvider.getRandom(); await UpdateWallpaper(); } catch (Exception ex) { ShowErrorNotification(); } }
/// <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(); } }