aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Azure/Tango.AzureUtils/AzureUtilsConfirmationEventArgs.cs
blob: 9a27e06de8b50a35b204de502e498a94ac0fba80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.AzureUtils
{
    public class AzureUtilsConfirmationEventArgs : EventArgs
    {
        private TaskCompletionSource<bool> _completionSource;

        public String Message { get; set; }

        public AzureUtilsConfirmationEventArgs(String message)
        {
            Message = message;
            _completionSource = new TaskCompletionSource<bool>();
        }

        internal Task<bool> GetAwaiter()
        {
            return _completionSource.Task;
        }

        public void Confirm()
        {
            _completionSource.SetResult(true);
        }

        public void Cancel()
        {
            _completionSource.SetResult(false);
        }
    }
}