Server/Slions/Ear/ActionSleep.cs
author StephaneLenclud
Fri, 22 Jul 2016 18:19:49 +0200
changeset 209 fef4ca058087
permissions -rw-r--r--
Prototype for event and action framework.
StephaneLenclud@209
     1
//
StephaneLenclud@209
     2
StephaneLenclud@209
     3
StephaneLenclud@209
     4
using System.Runtime.Serialization;
StephaneLenclud@209
     5
using System.Threading;
StephaneLenclud@209
     6
StephaneLenclud@209
     7
namespace Slions.Ear
StephaneLenclud@209
     8
{
StephaneLenclud@209
     9
    
StephaneLenclud@209
    10
StephaneLenclud@209
    11
    [DataContract]
StephaneLenclud@209
    12
    class ActionSleep : Action
StephaneLenclud@209
    13
    {
StephaneLenclud@209
    14
        static readonly string Name = "Sleep";
StephaneLenclud@209
    15
        static readonly string Description = "Have the current thread sleep for the specified amount of milliseconds.";
StephaneLenclud@209
    16
StephaneLenclud@209
    17
        private readonly int iMillisecondsTimeout;
StephaneLenclud@209
    18
StephaneLenclud@209
    19
        public ActionSleep()
StephaneLenclud@209
    20
        {
StephaneLenclud@209
    21
            iMillisecondsTimeout = 1000;
StephaneLenclud@209
    22
        }
StephaneLenclud@209
    23
StephaneLenclud@209
    24
StephaneLenclud@209
    25
        public ActionSleep(int aMillisecondsTimeout)
StephaneLenclud@209
    26
        {
StephaneLenclud@209
    27
            iMillisecondsTimeout = aMillisecondsTimeout;
StephaneLenclud@209
    28
        }
StephaneLenclud@209
    29
StephaneLenclud@209
    30
        public override void Execute()
StephaneLenclud@209
    31
        {
StephaneLenclud@209
    32
            Thread.Sleep(iMillisecondsTimeout);
StephaneLenclud@209
    33
        }
StephaneLenclud@209
    34
    }
StephaneLenclud@209
    35
StephaneLenclud@209
    36
StephaneLenclud@209
    37
StephaneLenclud@209
    38
}