SharpLibEar/ActionSleep.cs
author StephaneLenclud
Sun, 24 Jul 2016 20:46:34 +0200
changeset 215 5de8f8eaaa54
parent 210 83dd86e73448
child 219 99c407831232
permissions -rw-r--r--
Removing obsolete CEC options.
StephaneLenclud@210
     1
//
StephaneLenclud@210
     2
StephaneLenclud@210
     3
StephaneLenclud@210
     4
using System.Runtime.Serialization;
StephaneLenclud@210
     5
using System.Threading;
StephaneLenclud@210
     6
StephaneLenclud@210
     7
StephaneLenclud@210
     8
namespace SharpLib.Ear
StephaneLenclud@210
     9
{
StephaneLenclud@210
    10
    
StephaneLenclud@210
    11
StephaneLenclud@210
    12
    [DataContract]
StephaneLenclud@210
    13
    [AttributeAction(Id = "Thread.Sleep", Name = "Sleep", Description = "Have the current thread sleep for the specified amount of milliseconds.")]
StephaneLenclud@210
    14
    public class ActionSleep : Action
StephaneLenclud@210
    15
    {
Stephane@212
    16
        [DataMember]
StephaneLenclud@210
    17
        private readonly int iMillisecondsTimeout;
StephaneLenclud@210
    18
StephaneLenclud@210
    19
        public ActionSleep()
StephaneLenclud@210
    20
        {
StephaneLenclud@210
    21
            iMillisecondsTimeout = 1000;
StephaneLenclud@210
    22
        }
StephaneLenclud@210
    23
StephaneLenclud@210
    24
StephaneLenclud@210
    25
        public ActionSleep(int aMillisecondsTimeout)
StephaneLenclud@210
    26
        {
StephaneLenclud@210
    27
            iMillisecondsTimeout = aMillisecondsTimeout;
StephaneLenclud@210
    28
        }
StephaneLenclud@210
    29
StephaneLenclud@210
    30
        public override void Execute()
StephaneLenclud@210
    31
        {
StephaneLenclud@210
    32
            Thread.Sleep(iMillisecondsTimeout);
StephaneLenclud@210
    33
        }
StephaneLenclud@210
    34
StephaneLenclud@210
    35
    }
StephaneLenclud@210
    36
StephaneLenclud@210
    37
StephaneLenclud@210
    38
StephaneLenclud@210
    39
}