public void loadLocalVideoData() { //加载正在下载视频数据 string loadingVideos = WpStorage.ReadIsolatedStorageFile(downingVideosIso); if (!string.IsNullOrEmpty(loadingVideos)) { DowningVideo = JsonConvert.DeserializeObject <ObservableCollection <DownVideoInfoViewMoel> >(loadingVideos); foreach (DownVideoInfoViewMoel video in DowningVideo) { DowningVideoids.Add(video.VideoId); } } else { DowningVideo = null; } //加载完成下载视频数据 string loadedVideos = WpStorage.ReadIsolatedStorageFile(downedVideosIso); if (!string.IsNullOrEmpty(loadedVideos)) { DownedVideo = JsonConvert.DeserializeObject <ObservableCollection <DownVideoInfoViewMoel> >(loadedVideos); foreach (DownVideoInfoViewMoel video in DownedVideo) { DownedVideoids.Add(video.VideoId); } } else { DownedVideo = null; } }
public void AddDownVideo(VideoInfo videoInfo) { if (videoInfo.downloadUrl != null && videoInfo.downloadUrl.Count == 0) { App.ShowToast(videoInfo.name + " 没有可用下载链接"); return; } DownVideoInfoViewMoel video = new DownVideoInfoViewMoel(); video.Name = videoInfo.name; video.Image = videoInfo.image; video.Time = videoInfo.time; video.VideoId = videoInfo.videoId; video.VideoIndex = videoInfo.videoIndex; video.Desc = videoInfo.desc; video.IsLoading = false; video.IsLoaded = false; int downIndex = 0; for (int i = 0; i < videoInfo.downloadUrl.Count; i++) { if (videoInfo.downloadUrl[i].name == App.DownVideoModel.CurrentDefinitionName) { downIndex = i; break; } } video.DownUrl = videoInfo.downloadUrl[downIndex].url; DowningVideo.Add(video); DowningVideoids.Add(video.VideoId); SaveVideoData(); BeginDownVideos(); }