SharpLibEar/ActionCallback.cs
author StephaneLenclud
Wed, 27 Jul 2016 11:07:35 +0200
changeset 222 0e8c6c2f4777
child 223 f6272f65d8fc
permissions -rw-r--r--
Adding send and release CEC key actions.
Edit action ComboBox now sorted and selecting proper item.
StephaneLenclud@210
     1
//
StephaneLenclud@210
     2
StephaneLenclud@210
     3
using System.Runtime.Serialization;
StephaneLenclud@210
     4
StephaneLenclud@210
     5
StephaneLenclud@210
     6
namespace SharpLib.Ear
StephaneLenclud@210
     7
{
StephaneLenclud@210
     8
    [DataContract]
StephaneLenclud@210
     9
    public abstract class ActionCallback : Action
StephaneLenclud@210
    10
    {
StephaneLenclud@210
    11
        public delegate void Delegate();
StephaneLenclud@210
    12
StephaneLenclud@210
    13
        private readonly Delegate iCallback;
StephaneLenclud@210
    14
StephaneLenclud@210
    15
        public ActionCallback(Delegate aCallback = null)
StephaneLenclud@210
    16
        {
StephaneLenclud@210
    17
            iCallback = aCallback;
StephaneLenclud@210
    18
        }
StephaneLenclud@210
    19
StephaneLenclud@210
    20
        public override void Execute()
StephaneLenclud@210
    21
        {
StephaneLenclud@210
    22
            if (iCallback != null)
StephaneLenclud@210
    23
            {
StephaneLenclud@210
    24
                iCallback.Invoke();
StephaneLenclud@210
    25
            }            
StephaneLenclud@210
    26
        }
StephaneLenclud@210
    27
    }
StephaneLenclud@210
    28
StephaneLenclud@210
    29
}