SharpLibEar/ActionCallback.cs
author StephaneLenclud
Sat, 07 Jan 2017 20:21:42 +0100
changeset 277 71ba0dd622a5
parent 228 6a84d8282226
permissions -rw-r--r--
Created Audio Manager class.
Clean up CScore audio usage.
Fixing broken audio device change handler.
Fixed various audio Dispose deadlock due to Invoke usage.
Thus now using BeginInvoke instead.
     1 //
     2 
     3 using System.Runtime.Serialization;
     4 using System.Threading.Tasks;
     5 
     6 namespace SharpLib.Ear
     7 {
     8     [DataContract]
     9     public abstract class ActionCallback : Action
    10     {
    11         public delegate void Delegate();
    12 
    13         private readonly Delegate iCallback;
    14 
    15         public ActionCallback(Delegate aCallback = null)
    16         {
    17             iCallback = aCallback;
    18         }
    19 
    20         protected override async Task DoExecute()
    21         {
    22             if (iCallback != null)
    23             {
    24                 iCallback.Invoke();
    25             }            
    26         }
    27     }
    28 
    29 }