wabbajack/Wabbajack.Lib/StatusMessages/CriticalFailureIntervention.cs
Unnoen a5c6b6c05c
Fix CriticalFailureIntervention never being handled
Can also specify if Wabbajack should exit
2021-05-20 21:40:05 +10:00

32 lines
1.1 KiB
C#

using System.Threading.Tasks;
using Wabbajack.Common;
using Wabbajack.Common.StatusFeed;
namespace Wabbajack.Lib
{
/// <summary>
/// This should probably be replaced with an error, but this is just to get messageboxes out of the .Lib library
/// </summary>
public class CriticalFailureIntervention : AErrorMessage
{
private TaskCompletionSource<ConfirmationIntervention.Choice> _source = new TaskCompletionSource<ConfirmationIntervention.Choice>();
public Task<ConfirmationIntervention.Choice> Task => _source.Task;
public CriticalFailureIntervention(string description, string title, bool exit = false)
{
ExtendedDescription = description;
ShortDescription = title;
ExitApplication = exit;
}
public override string ShortDescription { get; }
public override string ExtendedDescription { get; }
public bool ExitApplication { get; }
public void Cancel()
{
_source.SetResult(ConfirmationIntervention.Choice.Abort);
}
}
}