SharpLibEar/ActionSleep.cs
author StephaneLenclud
Wed, 27 Jul 2016 11:07:35 +0200
changeset 222 0e8c6c2f4777
parent 219 99c407831232
child 223 f6272f65d8fc
permissions -rw-r--r--
Adding send and release CEC key actions.
Edit action ComboBox now sorted and selecting proper item.
     1 //
     2 
     3 
     4 using System.Runtime.Serialization;
     5 using System.Threading;
     6 
     7 
     8 namespace SharpLib.Ear
     9 {
    10     
    11 
    12     [DataContract]
    13     [AttributeAction(Id = "Thread.Sleep", Name = "Sleep", Description = "Have the current thread sleep for the specified amount of milliseconds.")]
    14     public class ActionSleep : Action
    15     {
    16         [DataMember]
    17         [AttributeActionProperty
    18             (
    19                 Id = "Thread.Sleep.Timeout",
    20                 Name = "Timeout (ms)",
    21                 Description = "Specifies the number of milliseconds this action will sleep for.",
    22                 Minimum = "0",
    23                 Maximum = "10000",
    24                 Increment =  "1"
    25             )
    26         ]
    27         public int TimeoutInMilliseconds { get; set; }
    28 
    29         public ActionSleep()
    30         {
    31             TimeoutInMilliseconds = 1000;
    32         }
    33 
    34 
    35         public ActionSleep(int aMillisecondsTimeout)
    36         {
    37             TimeoutInMilliseconds = aMillisecondsTimeout;
    38         }
    39 
    40         public override string Brief()
    41         {
    42             return Name + " for " + TimeoutInMilliseconds + " ms";
    43         }
    44 
    45 
    46         public override void Execute()
    47         {
    48             Thread.Sleep(TimeoutInMilliseconds);
    49         }
    50 
    51     }
    52 
    53 
    54 
    55 }