aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Operation/CartridgeValidationEventArgs.cs
blob: 6ef6e43c655e07aeda3a658f8c12dca9e9ec837d (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.PMR.Diagnostics;

namespace Tango.Integration.Operation
{
    /// <summary>
    /// Represents a cartridge validation request event arguments.
    /// </summary>
    /// <seealso cref="System.EventArgs" />
    public class CartridgeValidationEventArgs : EventArgs
    {
        private Action<int> _approveAction;
        private Action _declineAction;

        /// <summary>
        /// Initializes a new instance of the <see cref="CartridgeValidationEventArgs"/> class.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="approveAction">The approve action.</param>
        public CartridgeValidationEventArgs(CartridgeValidationRequest request, Action<int> approveAction,Action declineAction)
        {
            Request = request;
            _approveAction = approveAction;
            _declineAction = declineAction;
        }

        /// <summary>
        /// Gets the request.
        /// </summary>
        public CartridgeValidationRequest Request { get; private set; }

        /// <summary>
        /// Sends approved response for the specified cartridge index.
        /// </summary>
        /// <param name="cartridgeIndex">The cartridge index.</param>
        public void Approve(int cartridgeIndex)
        {
            _approveAction(cartridgeIndex);
        }

        public void Decline()
        {
            _declineAction();
        }
    }
}