mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
553a3123bd
Multiple Cancel calls threw unnecessary exception otherwise. Would rather be able to cancel multiple times without worrying about throwing
31 lines
806 B
C#
31 lines
806 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Wabbajack.Common;
|
|
|
|
namespace Wabbajack.Lib.NexusApi
|
|
{
|
|
public class RequestNexusAuthorization : AUserIntervention
|
|
{
|
|
public override string ShortDescription => "Getting User's Nexus API Key";
|
|
public override string ExtendedDescription { get; }
|
|
|
|
private readonly TaskCompletionSource<string> _source = new TaskCompletionSource<string>();
|
|
public Task<string> Task => _source.Task;
|
|
|
|
public void Resume(string apikey)
|
|
{
|
|
Handled = true;
|
|
_source.SetResult(apikey);
|
|
}
|
|
|
|
public override void Cancel()
|
|
{
|
|
Handled = true;
|
|
_source.TrySetCanceled();
|
|
}
|
|
}
|
|
}
|