优化 Issues #724下载完成提示

pull/741/head
初十 2 years ago
parent 29b154a225
commit 038e83b5b2

@ -561,6 +561,9 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Hardcodet.NotifyIcon.Wpf">
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json"> <PackageReference Include="Newtonsoft.Json">
<Version>13.0.2</Version> <Version>13.0.2</Version>
</PackageReference> </PackageReference>

@ -151,7 +151,7 @@
<!-- DownloadManager --> <!-- DownloadManager -->
<system:String x:Key="Downloading">正在下载</system:String> <system:String x:Key="Downloading">正在下载</system:String>
<system:String x:Key="DownloadFinished">已下载</system:String> <system:String x:Key="DownloadFinished">已下载</system:String>
<system:String x:Key="DownloadSuccess">下载完成</system:String>
<system:String x:Key="DownloadingAudio">音频</system:String> <system:String x:Key="DownloadingAudio">音频</system:String>
<system:String x:Key="DownloadingVideo">视频</system:String> <system:String x:Key="DownloadingVideo">视频</system:String>
<system:String x:Key="DownloadingDanmaku">弹幕</system:String> <system:String x:Key="DownloadingDanmaku">弹幕</system:String>

@ -67,7 +67,7 @@
<!-- DownloadManager --> <!-- DownloadManager -->
<system:String x:Key="Downloading">正在下载</system:String> <system:String x:Key="Downloading">正在下载</system:String>
<system:String x:Key="DownloadFinished">已下载</system:String> <system:String x:Key="DownloadFinished">已下载</system:String>
<system:String x:Key="DownloadSuccess">下载完成</system:String>
<!-- Settings --> <!-- Settings -->
<system:String x:Key="PressEnterToApplySettingTip">按回车键应用设置</system:String> <system:String x:Key="PressEnterToApplySettingTip">按回车键应用设置</system:String>

@ -68,7 +68,7 @@
<!-- DownloadManager --> <!-- DownloadManager -->
<system:String x:Key="Downloading">正在下载</system:String> <system:String x:Key="Downloading">正在下载</system:String>
<system:String x:Key="DownloadFinished">已下载</system:String> <system:String x:Key="DownloadFinished">已下载</system:String>
<system:String x:Key="DownloadSuccess">下载完成</system:String>
<!-- Settings --> <!-- Settings -->
<system:String x:Key="PressEnterToApplySettingTip">按回车键应用设置</system:String> <system:String x:Key="PressEnterToApplySettingTip">按回车键应用设置</system:String>

@ -68,7 +68,7 @@
<!-- DownloadManager --> <!-- DownloadManager -->
<system:String x:Key="Downloading">正在下载</system:String> <system:String x:Key="Downloading">正在下载</system:String>
<system:String x:Key="DownloadFinished">已下载</system:String> <system:String x:Key="DownloadFinished">已下载</system:String>
<system:String x:Key="DownloadSuccess">下载完成</system:String>
<!-- Settings --> <!-- Settings -->
<system:String x:Key="PressEnterToApplySettingTip">按回车键应用设置</system:String> <system:String x:Key="PressEnterToApplySettingTip">按回车键应用设置</system:String>

@ -11,6 +11,7 @@ using DownKyi.Images;
using DownKyi.Models; using DownKyi.Models;
using DownKyi.Utils; using DownKyi.Utils;
using DownKyi.ViewModels.DownloadManager; using DownKyi.ViewModels.DownloadManager;
using Hardcodet.Wpf.TaskbarNotification;
using Prism.Services.Dialogs; using Prism.Services.Dialogs;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -19,15 +20,15 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
namespace DownKyi.Services.Download namespace DownKyi.Services.Download
{ {
public abstract class DownloadService public abstract class DownloadService
{ {
protected string Tag = "DownloadService"; protected string Tag = "DownloadService";
protected TaskbarIcon _notifyIcon;
protected IDialogService dialogService; protected IDialogService dialogService;
protected ObservableCollection<DownloadingItem> downloadingList; protected ObservableCollection<DownloadingItem> downloadingList;
protected ObservableCollection<DownloadedItem> downloadedList; protected ObservableCollection<DownloadedItem> downloadedList;
@ -673,6 +674,7 @@ namespace DownKyi.Services.Download
DownloadFinishedSort finishedSort = SettingsManager.GetInstance().GetDownloadFinishedSort(); DownloadFinishedSort finishedSort = SettingsManager.GetInstance().GetDownloadFinishedSort();
App.SortDownloadedList(finishedSort); App.SortDownloadedList(finishedSort);
})); }));
_notifyIcon.ShowBalloonTip("下载完成",$"{downloadedItem.DownloadBase.Name}", BalloonIcon.Info);
})); }));
} }
catch (OperationCanceledException e) catch (OperationCanceledException e)
@ -795,7 +797,6 @@ namespace DownKyi.Services.Download
downloadStorageService.UpdateDownloaded(item); downloadStorageService.UpdateDownloaded(item);
} }
} }
/// <summary> /// <summary>
/// 启动基本下载服务 /// 启动基本下载服务
/// </summary> /// </summary>
@ -803,6 +804,7 @@ namespace DownKyi.Services.Download
{ {
tokenSource = new CancellationTokenSource(); tokenSource = new CancellationTokenSource();
cancellationToken = tokenSource.Token; cancellationToken = tokenSource.Token;
_notifyIcon = new TaskbarIcon();
workTask = Task.Run(DoWork); workTask = Task.Run(DoWork);
} }

Loading…
Cancel
Save