mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2025-07-25 21:04:01 +00:00
34 lines
834 B
C#
34 lines
834 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using ReactiveUI;
|
|
using Wabbajack.DTOs.Interventions;
|
|
|
|
namespace Wabbajack.Messages;
|
|
|
|
public class ALoginMessage : IUserIntervention
|
|
{
|
|
private readonly CancellationTokenSource _source;
|
|
public TaskCompletionSource CompletionSource { get; }
|
|
public CancellationToken Token => _source.Token;
|
|
public void SetException(Exception exception)
|
|
{
|
|
CompletionSource.SetException(exception);
|
|
_source.Cancel();
|
|
}
|
|
|
|
public ALoginMessage()
|
|
{
|
|
CompletionSource = new TaskCompletionSource();
|
|
_source = new CancellationTokenSource();
|
|
|
|
}
|
|
|
|
public void Cancel()
|
|
{
|
|
_source.Cancel();
|
|
CompletionSource.TrySetCanceled();
|
|
}
|
|
|
|
public bool Handled => CompletionSource.Task.IsCompleted;
|
|
} |