StephaneLenclud@210: // StephaneLenclud@210: StephaneLenclud@210: StephaneLenclud@210: using System.Runtime.Serialization; StephaneLenclud@210: using System.Threading; StephaneLenclud@210: StephaneLenclud@210: StephaneLenclud@210: namespace SharpLib.Ear StephaneLenclud@210: { StephaneLenclud@210: StephaneLenclud@210: StephaneLenclud@210: [DataContract] StephaneLenclud@210: [AttributeAction(Id = "Thread.Sleep", Name = "Sleep", Description = "Have the current thread sleep for the specified amount of milliseconds.")] StephaneLenclud@210: public class ActionSleep : Action StephaneLenclud@210: { Stephane@212: [DataMember] StephaneLenclud@220: [AttributeActionProperty StephaneLenclud@220: ( StephaneLenclud@220: Id = "Thread.Sleep.Timeout", StephaneLenclud@220: Name = "Timeout (ms)", StephaneLenclud@220: Description = "Specifies the number of milliseconds this action will sleep for.", StephaneLenclud@220: Minimum = "0", StephaneLenclud@220: Maximum = "10000", StephaneLenclud@220: Increment = "1" StephaneLenclud@220: ) StephaneLenclud@220: ] StephaneLenclud@219: public int TimeoutInMilliseconds { get; set; } StephaneLenclud@210: StephaneLenclud@210: public ActionSleep() StephaneLenclud@210: { StephaneLenclud@219: TimeoutInMilliseconds = 1000; StephaneLenclud@210: } StephaneLenclud@210: StephaneLenclud@210: StephaneLenclud@210: public ActionSleep(int aMillisecondsTimeout) StephaneLenclud@210: { StephaneLenclud@219: TimeoutInMilliseconds = aMillisecondsTimeout; StephaneLenclud@210: } StephaneLenclud@210: StephaneLenclud@220: public override string Brief() StephaneLenclud@220: { StephaneLenclud@220: return Name + " for " + TimeoutInMilliseconds + " ms"; StephaneLenclud@220: } StephaneLenclud@220: StephaneLenclud@220: StephaneLenclud@210: public override void Execute() StephaneLenclud@210: { StephaneLenclud@219: Thread.Sleep(TimeoutInMilliseconds); StephaneLenclud@210: } StephaneLenclud@210: StephaneLenclud@210: } StephaneLenclud@210: StephaneLenclud@210: StephaneLenclud@210: StephaneLenclud@210: }