更新界面任务状态
parent
40ecba881f
commit
e6e60df9bf
|
|
@ -53,7 +53,7 @@ public class MinioDownloadTask : INotifyPropertyChanged
|
||||||
[SugarColumn(ColumnName = "file_path")]
|
[SugarColumn(ColumnName = "file_path")]
|
||||||
public string FilePath { get; set; }
|
public string FilePath { get; set; }
|
||||||
|
|
||||||
[SugarColumn(ColumnName = "status")] public string Status { get; private set; } = "等待中";
|
[SugarColumn(ColumnName = "status")] public string Status { get; set; } = "等待中";
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string Progress
|
public string Progress
|
||||||
|
|
@ -70,7 +70,7 @@ public class MinioDownloadTask : INotifyPropertyChanged
|
||||||
CancelCommand = new CustomCommand(OnCancel);
|
CancelCommand = new CustomCommand(OnCancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MinioDownloadTask(MinioService minio, string bucket, string objectKey,string downDir)
|
public MinioDownloadTask(MinioService minio, string bucket, string objectKey, string downDir)
|
||||||
{
|
{
|
||||||
Status = "等待中";
|
Status = "等待中";
|
||||||
_minio = minio;
|
_minio = minio;
|
||||||
|
|
|
||||||
|
|
@ -174,9 +174,10 @@ public class DownViewModel : MvcViewModelBase
|
||||||
while (!_processingCts.IsCancellationRequested)
|
while (!_processingCts.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
await _semaphore.WaitAsync();
|
await _semaphore.WaitAsync();
|
||||||
|
Console.WriteLine("获得下载许可");
|
||||||
if (_taskQueue.TryDequeue(out var task))
|
if (_taskQueue.TryDequeue(out var task))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"我进入的异常下载{c1++}");
|
Console.WriteLine($"开启下载任务:{c1++}");
|
||||||
// 启动新线程执行下载任务
|
// 启动新线程执行下载任务
|
||||||
// _ = Task.Run(() => ExecuteTaskAsync(task));
|
// _ = Task.Run(() => ExecuteTaskAsync(task));
|
||||||
_ = ExecuteTaskAsync(task).ContinueWith(_ => _semaphore.Release());
|
_ = ExecuteTaskAsync(task).ContinueWith(_ => _semaphore.Release());
|
||||||
|
|
@ -204,6 +205,9 @@ public class DownViewModel : MvcViewModelBase
|
||||||
{
|
{
|
||||||
await task.StartDownload();
|
await task.StartDownload();
|
||||||
var x = AllTasks.IndexOf(task);
|
var x = AllTasks.IndexOf(task);
|
||||||
|
var temp = AllTasks[x];
|
||||||
|
temp.Status = "已完成";
|
||||||
|
Console.WriteLine($"所有任务取出任务id {temp.TaskId} 完成任务id:{task.TaskId}" );
|
||||||
Console.WriteLine($"完成任务在全部任务中的位置 :{x}");
|
Console.WriteLine($"完成任务在全部任务中的位置 :{x}");
|
||||||
RefreshViewHeader();
|
RefreshViewHeader();
|
||||||
Console.WriteLine($"异步下载完成:{task.FileName}");
|
Console.WriteLine($"异步下载完成:{task.FileName}");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue