From 384b39401427eeea8dd2801949790489cd4898dc Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Wed, 12 Jan 2022 01:11:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=90=AF=E5=90=8E=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=BC=80=E5=A7=8B=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Download/AriaDownloadService.cs | 28 +++++++++++++- .../DownloadManager/DownloadingItem.cs | 37 ++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) 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; }