/// <summary> /// 使用后在 <see cref="WallpaperInfos"/> 中获得壁纸信息 /// </summary> /// <returns></returns> private async Task Get360ImageUriCollectionAsync() { BirdWallpaperJsonObject wallPaper360JsonInfo = await Json.GetWebRequestObjectAsync <BirdWallpaperJsonObject>(WallPaper360BaseUrL);//await GetRequest360WallPaperImageJsonInfoAsync(); foreach (DataItemFor360 dataItem in wallPaper360JsonInfo.Data) { Wallpaper wallpaperInfo = new Wallpaper() { Uri = new Uri(dataItem.Url), Description = dataItem.Utag, }; WallpaperInfos.Add(wallpaperInfo); } }
private void Window_Loaded(object sender, RoutedEventArgs eventArgs) { this.SetAcrylicblur(); //处理速度慢的计算机不能正常的给ObservableWallpaperInfos赋值 //需要额外添加判断 if (ObservableWallpaperInfos.Count > 0) { Selected = ObservableWallpaperInfos[0]; } else { NotificationManager.ShowNotification("Snap Desktop/壁纸", "加载壁纸时遇到问题\n请手动选择你想要查看的壁纸"); Selected = null; } }
/// <summary> /// 使用后在 <see cref="WallpaperInfos"/> 中获得壁纸信息 /// </summary> /// <returns></returns> private async Task GetBingImageUriCollectionAsync() { string basedBingUrl = "http://cn.bing.com"; BingImageJsonObject bingImageJsonInfo = await Json.GetWebRequestObjectAsync <BingImageJsonObject>(WallPaperBingBaseUrL); foreach (ImageItemForBing imageItemForBing in bingImageJsonInfo.Images) { Wallpaper wallpaperInfo = new Wallpaper() { Uri = new Uri(basedBingUrl + imageItemForBing.Url), Description = imageItemForBing.Copyright, }; WallpaperInfos.Add(wallpaperInfo); } }