wabbajack/Wabbajack.App.Wpf/UserIntervention/ManualDownloadHandler.cs

30 lines
876 B
C#
Raw Normal View History

2022-05-16 22:14:52 +00:00
using System.Security.Policy;
using System.Threading;
using System.Threading.Tasks;
using Wabbajack.DTOs;
using Wabbajack.DTOs.DownloadStates;
using Wabbajack.DTOs.Interventions;
using Wabbajack.Paths;
namespace Wabbajack.UserIntervention;
2022-05-20 03:23:16 +00:00
public class ManualDownloadHandler : BrowserWindowViewModel
2022-05-16 22:14:52 +00:00
{
public ManualDownload Intervention { get; set; }
2022-05-16 22:14:52 +00:00
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})";
2022-05-19 21:47:15 +00:00
2022-05-16 22:14:52 +00:00
Instructions = string.IsNullOrWhiteSpace(md.Prompt) ? $"Please download {archive.Name}" : md.Prompt;
await NavigateTo(md.Url);
var uri = await WaitForDownloadUri(token);
Intervention.Finish(uri);
}
}