SharpLibEar/ActionSleep.cs
author StephaneLenclud
Sun, 21 Aug 2016 19:31:08 +0200
changeset 251 f60cfcb98c9a
parent 228 6a84d8282226
child 258 e237c2e33545
permissions -rw-r--r--
Published v0.12.2.0
Adding setting for Logitech user name.
Improved event tree view update following Harmony connection.
Removed unneeded editable fields from Harmony command action.
     1 //
     2 
     3 
     4 using System.Runtime.Serialization;
     5 using System.Threading;
     6 
     7 
     8 namespace SharpLib.Ear
     9 {
    10     
    11 
    12     [DataContract]
    13     [AttributeObject(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         [AttributeObjectProperty
    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         protected override void DoExecute()
    47         {
    48             Thread.Sleep(TimeoutInMilliseconds);
    49         }
    50 
    51     }
    52 
    53 
    54 
    55 }