重启后不会自动开始下载

croire 3 years ago
parent 3b2de59d0b
commit 384b394014

@ -394,7 +394,28 @@ namespace DownKyi.Services.Download
// 保存数据 // 保存数据
foreach (DownloadingItem item in downloadingList) foreach (DownloadingItem item in downloadingList)
{ {
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.WAIT_FOR_DOWNLOAD;
item.Downloading.DownloadStatus = DownloadStatus.PAUSE;
break;
case DownloadStatus.DOWNLOAD_SUCCEED:
case DownloadStatus.DOWNLOAD_FAILED:
break;
default:
break;
}
item.Progress = 0; item.Progress = 0;
downloadStorageService.UpdateDownloading(item); downloadStorageService.UpdateDownloading(item);
@ -677,6 +698,11 @@ namespace DownKyi.Services.Download
if (!isMediaSuccess || !isDanmakuSuccess || !isSubtitleSuccess || !isCover) 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.Downloading.DownloadStatus = DownloadStatus.DOWNLOAD_FAILED;
downloading.StartOrPause = ButtonIcon.Instance().Retry; downloading.StartOrPause = ButtonIcon.Instance().Retry;
downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary");

@ -20,7 +20,42 @@ namespace DownKyi.ViewModels.DownloadManager
} }
// model数据 // 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; } public PlayUrl PlayUrl { get; set; }

Loading…
Cancel
Save