1. 已完成倒序(未完成)
parent
995671e0eb
commit
72a1b44cca
|
|
@ -205,6 +205,7 @@ public class MinioDownloadTask : NotifyPropertyChangedBase
|
||||||
}, offset: offset);
|
}, offset: offset);
|
||||||
Status = "已完成";
|
Status = "已完成";
|
||||||
updateTask.Status = Status;
|
updateTask.Status = Status;
|
||||||
|
updateTask.Downloaded = TotalSize;
|
||||||
updateTask.FinishedTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
updateTask.FinishedTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
using (var client = SqlSugarConfig.GetSqlSugarScope())
|
using (var client = SqlSugarConfig.GetSqlSugarScope())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using HeBianGu.Base.WpfBase;
|
using HeBianGu.Base.WpfBase;
|
||||||
using HeBianGu.Service.Mvc;
|
using HeBianGu.Service.Mvc;
|
||||||
|
|
@ -140,6 +142,18 @@ public class DownViewModel : MvcViewModelBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private CollectionViewSource _finishedTasksViewSource;
|
||||||
|
|
||||||
|
public CollectionViewSource FinishedTasksViewSource
|
||||||
|
{
|
||||||
|
get => _finishedTasksViewSource;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_finishedTasksViewSource = value;
|
||||||
|
RaisePropertyChanged(); // 触发INotifyProperty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int _maxConcurrent = 3;
|
private int _maxConcurrent = 3;
|
||||||
|
|
||||||
public int MaxConcurrent
|
public int MaxConcurrent
|
||||||
|
|
@ -167,6 +181,8 @@ public class DownViewModel : MvcViewModelBase
|
||||||
public DownViewModel(MinioService minioService)
|
public DownViewModel(MinioService minioService)
|
||||||
{
|
{
|
||||||
_minioService = minioService;
|
_minioService = minioService;
|
||||||
|
FinishedTasksViewSource = new CollectionViewSource { Source = FinishedTasks };
|
||||||
|
FinishedTasksViewSource.SortDescriptions.Add(new SortDescription("FinishedTime", ListSortDirection.Descending));
|
||||||
Console.WriteLine("初始化DownViewModel");
|
Console.WriteLine("初始化DownViewModel");
|
||||||
using var client = SqlSugarConfig.GetSqlSugarScope();
|
using var client = SqlSugarConfig.GetSqlSugarScope();
|
||||||
OpenDownItemFolder = new RelayCommand<MinioDownloadTask>(DoOpenDownItemFolder);
|
OpenDownItemFolder = new RelayCommand<MinioDownloadTask>(DoOpenDownItemFolder);
|
||||||
|
|
@ -188,7 +204,7 @@ public class DownViewModel : MvcViewModelBase
|
||||||
{
|
{
|
||||||
item.Status = "已暂停";
|
item.Status = "已暂停";
|
||||||
item.StartOrPauseIcon = "\xe748";
|
item.StartOrPauseIcon = "\xe748";
|
||||||
// 速度及剩余时间
|
// 速度及剩余时间(视图显示信息)
|
||||||
item.Speed = "已暂停";
|
item.Speed = "已暂停";
|
||||||
//暂停下载
|
//暂停下载
|
||||||
item.StopDownTs.Cancel();
|
item.StopDownTs.Cancel();
|
||||||
|
|
@ -247,6 +263,11 @@ public class DownViewModel : MvcViewModelBase
|
||||||
{
|
{
|
||||||
if (_taskQueue.TryDequeue(out var task))
|
if (_taskQueue.TryDequeue(out var task))
|
||||||
{
|
{
|
||||||
|
if (task.Status == "已暂停")
|
||||||
|
{
|
||||||
|
// 跳过暂停,但之前已加入队列
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Console.WriteLine("存在可下载任务,正在申请许可...");
|
Console.WriteLine("存在可下载任务,正在申请许可...");
|
||||||
await _semaphore.WaitAsync();
|
await _semaphore.WaitAsync();
|
||||||
Console.WriteLine("申请下载许可成功!马上开启下载");
|
Console.WriteLine("申请下载许可成功!马上开启下载");
|
||||||
|
|
@ -329,7 +350,7 @@ public class DownViewModel : MvcViewModelBase
|
||||||
|
|
||||||
public void DoOpenDownItemFolder(MinioDownloadTask para)
|
public void DoOpenDownItemFolder(MinioDownloadTask para)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"点击item值:{JsonConvert.SerializeObject(para)}");
|
//Console.WriteLine($"点击item值:{JsonConvert.SerializeObject(para)}");
|
||||||
//Process.Start("explorer.exe", para.FilePath);
|
//Process.Start("explorer.exe", para.FilePath);
|
||||||
var file = Path.Combine(para.FilePath, para.FileName);
|
var file = Path.Combine(para.FilePath, para.FileName);
|
||||||
Process.Start("explorer.exe", $"/select,\"{file}\"");
|
Process.Start("explorer.exe", $"/select,\"{file}\"");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue