SharpLibEar/ActionCallback.cs
author StephaneLenclud
Fri, 29 Jul 2016 10:40:15 +0200
changeset 226 91763ba41c0c
parent 210 83dd86e73448
child 228 6a84d8282226
permissions -rw-r--r--
Renaming main form.
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@223
    20
        public override void DoExecute()
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
}