private void xAction_Tap(object sender, System.Windows.Input.GestureEventArgs e) { Grid grid = sender as Grid; MediaFileDownload downloader = MediaFileDownload.Find(grid.Tag as string); if (downloader != null) { switch (downloader.Status) { case DownloadStatus.Downloading: case DownloadStatus.Waiting: downloader.Pause(); break; case DownloadStatus.Error: case DownloadStatus.Paused: case DownloadStatus.Timeout: case DownloadStatus.InsufficientDiskSpace: { _vid = downloader.Tag as string; foreach (DownInfo info in MyDownloading) { if (info.VID == _vid) { info.StatusImage = "/PPTVForWP7;component/Images/Download.png"; break; } } string[] id = _vid.Split('|'); if (string.IsNullOrEmpty(id[1])) { //电影 StartDownloadProgram(Convert.ToInt32(id[0])); } else { //剧集 StartDownloadProgram(Convert.ToInt32(id[2])); } } break; default: break; } } }
public static void UpdateTask(string vid, string downUrl) { MediaFileDownload.Find(vid).MediaFileUrl = new Uri(downUrl, UriKind.RelativeOrAbsolute); string fileName = MediaFileDownload.Find(vid).MediaFileUrl.AbsolutePath; if (fileName[0] == '/') { fileName = fileName.Remove(0, 1); } MediaFileDownload.Find(vid).FileName = fileName; DownFactory.UpdateFileNameRecord(vid, MediaFileDownload.Find(vid).PathName); foreach (DownInfo info in MyDownloading) { if (info.VID == vid) { info.LocalPathName = MediaFileDownload.Find(vid).PathName; break; } } MediaFileDownload.Find(vid).Start(); }