mirror of
https://github.com/leiurayer/downkyi.git
synced 2025-03-26 01:00:11 +08:00
如果存在下载完成列表,弹出选择框是否再次下载
This commit is contained in:
parent
f2b82a44b5
commit
1a158dce32
@ -144,7 +144,8 @@
|
||||
|
||||
<system:String x:Key="TipAlreadyToAddDownloading">已经添加到下载列表~</system:String>
|
||||
<system:String x:Key="TipAlreadyToAddDownloaded">已经下载完成~</system:String>
|
||||
<system:String x:Key="TipAddDownloadingZero">没有选中项符合下载要求!</system:String>
|
||||
<system:String x:Key="TipAlreadyToAddDownloaded2">该视频已经下载完成,是否重新下载?</system:String>
|
||||
<system:String x:Key="TipAddDownloadingZero">没有添加任何视频~</system:String>
|
||||
<system:String x:Key="TipAddDownloadingFinished1">成功添加了</system:String>
|
||||
<system:String x:Key="TipAddDownloadingFinished2">项~</system:String>
|
||||
|
||||
|
@ -67,10 +67,15 @@ namespace DownKyi.Services
|
||||
{ "message", message },
|
||||
{ "button_number", buttonNumber }
|
||||
};
|
||||
dialogService.ShowDialog(ViewAlertDialogViewModel.Tag, param, buttonResult =>
|
||||
|
||||
App.PropertyChangeAsync(() =>
|
||||
{
|
||||
result = buttonResult.Result;
|
||||
dialogService.ShowDialog(ViewAlertDialogViewModel.Tag, param, buttonResult =>
|
||||
{
|
||||
result = buttonResult.Result;
|
||||
});
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ namespace DownKyi.Services.Download
|
||||
/// <param name="directory">下载路径</param>
|
||||
/// <param name="isAll">是否下载所有,包括未选中项</param>
|
||||
/// <returns>添加的数量</returns>
|
||||
public int AddToDownload(IEventAggregator eventAggregator, string directory, bool isAll = false)
|
||||
public int AddToDownload(IEventAggregator eventAggregator, IDialogService dialogService, string directory, bool isAll = false)
|
||||
{
|
||||
if (directory == null || directory == string.Empty) { return -1; }
|
||||
if (videoSections == null) { return -1; }
|
||||
@ -269,7 +269,7 @@ namespace DownKyi.Services.Download
|
||||
}
|
||||
if (isDownloading) { continue; }
|
||||
|
||||
// TODO 如果存在下载完成列表,弹出选择框是否再次下载
|
||||
// 如果存在下载完成列表,弹出选择框是否再次下载
|
||||
bool isDownloaded = false;
|
||||
foreach (DownloadedItem item in App.DownloadedList)
|
||||
{
|
||||
@ -277,8 +277,25 @@ namespace DownKyi.Services.Download
|
||||
|
||||
if (item.DownloadBase.Cid == page.Cid && item.Resolution.Id == page.VideoQuality.Quality && item.AudioCodec.Name == page.AudioQualityFormat && item.VideoCodecName == page.VideoQuality.SelectedVideoCodec)
|
||||
{
|
||||
eventAggregator.GetEvent<MessageEvent>().Publish($"{page.Name}{DictionaryResource.GetString("TipAlreadyToAddDownloaded")}");
|
||||
isDownloaded = true;
|
||||
//eventAggregator.GetEvent<MessageEvent>().Publish($"{page.Name}{DictionaryResource.GetString("TipAlreadyToAddDownloaded")}");
|
||||
//isDownloaded = true;
|
||||
|
||||
AlertService alertService = new AlertService(dialogService);
|
||||
ButtonResult result = alertService.ShowInfo(DictionaryResource.GetString("TipAlreadyToAddDownloaded2"));
|
||||
if (result == ButtonResult.OK)
|
||||
{
|
||||
App.PropertyChangeAsync(() =>
|
||||
{
|
||||
App.DownloadedList.Remove(item);
|
||||
});
|
||||
|
||||
isDownloaded = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
isDownloaded = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(videoInfoService);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -348,7 +348,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(service);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -378,7 +378,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(videoInfoService);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -291,7 +291,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(service);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -277,7 +277,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(videoInfoService);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -298,7 +298,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(videoInfoService);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -332,7 +332,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(videoInfoService);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -296,7 +296,7 @@ namespace DownKyi.ViewModels
|
||||
addToDownloadService.GetVideo();
|
||||
addToDownloadService.ParseVideo(videoInfoService);
|
||||
// 下载
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, directory);
|
||||
i += addToDownloadService.AddToDownload(eventAggregator, dialogService, directory);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -773,7 +773,7 @@ namespace DownKyi.ViewModels
|
||||
// 传递video对象
|
||||
addToDownloadService.GetVideo(VideoInfoView, VideoSections.ToList());
|
||||
// 下载
|
||||
i = addToDownloadService.AddToDownload(eventAggregator, directory, isAll);
|
||||
i = addToDownloadService.AddToDownload(eventAggregator, dialogService, directory, isAll);
|
||||
});
|
||||
|
||||
if (directory == null)
|
||||
|
Loading…
Reference in New Issue
Block a user