2022-05-19 03:21:38 +00:00
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Wabbajack.DTOs.DownloadStates;
|
|
|
|
using Wabbajack.DTOs.Interventions;
|
|
|
|
|
|
|
|
namespace Wabbajack.UserIntervention;
|
|
|
|
|
2022-05-20 03:23:16 +00:00
|
|
|
public class ManualBlobDownloadHandler : BrowserWindowViewModel
|
2022-05-19 03:21:38 +00:00
|
|
|
{
|
|
|
|
public ManualBlobDownload Intervention { get; set; }
|
|
|
|
|
|
|
|
protected override async Task Run(CancellationToken token)
|
|
|
|
{
|
|
|
|
await WaitForReady();
|
|
|
|
var archive = Intervention.Archive;
|
|
|
|
var md = Intervention.Archive.State as Manual;
|
|
|
|
|
|
|
|
HeaderText = $"Manual download ({md.Url.Host})";
|
|
|
|
|
|
|
|
Instructions = string.IsNullOrWhiteSpace(md.Prompt) ? $"Please download {archive.Name}" : md.Prompt;
|
|
|
|
var tsk = WaitForDownload(Intervention.Destination, token);
|
|
|
|
await NavigateTo(md.Url);
|
|
|
|
var hash = await tsk;
|
|
|
|
|
|
|
|
Intervention.Finish(hash);
|
|
|
|
}
|
|
|
|
}
|