Add InfoEvent with confirmation
This commit is contained in:
21
Jugenddienst Stunden/Models/ConfirmationEventArgs.cs
Normal file
21
Jugenddienst Stunden/Models/ConfirmationEventArgs.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Jugenddienst_Stunden.Models;
|
||||
public sealed class ConfirmationEventArgs : System.EventArgs {
|
||||
public string Title { get; }
|
||||
public string Message { get; }
|
||||
public string ConfirmText { get; }
|
||||
|
||||
private readonly TaskCompletionSource<bool> _tcs = new();
|
||||
|
||||
public ConfirmationEventArgs(string title, string message, string confirmText = "OK") {
|
||||
Title = title;
|
||||
Message = message;
|
||||
ConfirmText = confirmText;
|
||||
}
|
||||
|
||||
public Task<bool> Task => _tcs.Task;
|
||||
|
||||
public void SetResult(bool result) => _tcs.TrySetResult(result);
|
||||
}
|
||||
Reference in New Issue
Block a user