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