diff --git a/DownKyi/Services/Download/AriaDownloadService.cs b/DownKyi/Services/Download/AriaDownloadService.cs index 7806276..3cf1351 100644 --- a/DownKyi/Services/Download/AriaDownloadService.cs +++ b/DownKyi/Services/Download/AriaDownloadService.cs @@ -394,7 +394,28 @@ namespace DownKyi.Services.Download // 保存数据 foreach (DownloadingItem item in downloadingList) { - item.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; + switch (item.Downloading.DownloadStatus) + { + case DownloadStatus.NOT_STARTED: + break; + case DownloadStatus.WAIT_FOR_DOWNLOAD: + break; + case DownloadStatus.PAUSE_STARTED: + break; + case DownloadStatus.PAUSE: + break; + case DownloadStatus.DOWNLOADING: + // TODO 添加设置让用户选择重启后是否自动开始下载 + item.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; + item.Downloading.DownloadStatus = DownloadStatus.PAUSE; + break; + case DownloadStatus.DOWNLOAD_SUCCEED: + case DownloadStatus.DOWNLOAD_FAILED: + break; + default: + break; + } + item.Progress = 0; downloadStorageService.UpdateDownloading(item); @@ -677,6 +698,11 @@ namespace DownKyi.Services.Download if (!isMediaSuccess || !isDanmakuSuccess || !isSubtitleSuccess || !isCover) { + downloading.DownloadStatusTitle = DictionaryResource.GetString("DownloadFailed"); + downloading.DownloadContent = string.Empty; + downloading.DownloadingFileSize = string.Empty; + downloading.SpeedDisplay = string.Empty; + downloading.Downloading.DownloadStatus = DownloadStatus.DOWNLOAD_FAILED; downloading.StartOrPause = ButtonIcon.Instance().Retry; downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); diff --git a/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs b/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs index aa2f30d..899df6f 100644 --- a/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs +++ b/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs @@ -20,7 +20,42 @@ namespace DownKyi.ViewModels.DownloadManager } // model数据 - public Downloading Downloading { get; set; } + private Downloading downloading; + public Downloading Downloading + { + get { return downloading; } + set + { + downloading = value; + + switch (value.DownloadStatus) + { + case DownloadStatus.NOT_STARTED: + case DownloadStatus.WAIT_FOR_DOWNLOAD: + StartOrPause = ButtonIcon.Instance().Pause; + break; + case DownloadStatus.PAUSE_STARTED: + StartOrPause = ButtonIcon.Instance().Start; + break; + case DownloadStatus.PAUSE: + StartOrPause = ButtonIcon.Instance().Start; + break; + case DownloadStatus.DOWNLOADING: + StartOrPause = ButtonIcon.Instance().Pause; + break; + case DownloadStatus.DOWNLOAD_SUCCEED: + // 下载成功后会从下载列表中删除 + // 不会出现此分支 + break; + case DownloadStatus.DOWNLOAD_FAILED: + StartOrPause = ButtonIcon.Instance().Retry; + break; + default: + break; + } + StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); + } + } // 视频流链接 public PlayUrl PlayUrl { get; set; }