2020-01-07 13:03:46 +00:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Wabbajack.Common;
|
2020-06-01 20:26:03 +00:00
|
|
|
|
using Wabbajack.Common.StatusFeed;
|
2020-01-07 13:03:46 +00:00
|
|
|
|
|
|
|
|
|
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>
|
2020-06-01 20:26:03 +00:00
|
|
|
|
public class CriticalFailureIntervention : AErrorMessage
|
2020-01-07 13:03:46 +00:00
|
|
|
|
{
|
|
|
|
|
private TaskCompletionSource<ConfirmationIntervention.Choice> _source = new TaskCompletionSource<ConfirmationIntervention.Choice>();
|
|
|
|
|
public Task<ConfirmationIntervention.Choice> Task => _source.Task;
|
|
|
|
|
|
2021-05-20 11:40:05 +00:00
|
|
|
|
public CriticalFailureIntervention(string description, string title, bool exit = false)
|
2020-01-07 13:03:46 +00:00
|
|
|
|
{
|
|
|
|
|
ExtendedDescription = description;
|
|
|
|
|
ShortDescription = title;
|
2021-05-20 11:40:05 +00:00
|
|
|
|
ExitApplication = exit;
|
2020-01-07 13:03:46 +00:00
|
|
|
|
}
|
2021-05-20 11:40:05 +00:00
|
|
|
|
|
2020-01-07 13:03:46 +00:00
|
|
|
|
public override string ShortDescription { get; }
|
|
|
|
|
public override string ExtendedDescription { get; }
|
2021-05-20 11:40:05 +00:00
|
|
|
|
public bool ExitApplication { get; }
|
|
|
|
|
|
2020-06-01 20:26:03 +00:00
|
|
|
|
public void Cancel()
|
2020-01-07 13:03:46 +00:00
|
|
|
|
{
|
|
|
|
|
_source.SetResult(ConfirmationIntervention.Choice.Abort);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|