Corrects spelling mistake and adds check to see if thread is already running before allowing sequence to start

This commit is contained in:
Neil Dorin
2021-02-11 16:44:18 -07:00
parent 2fc1f45161
commit 16bc2ca381

View File

@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.Core.Utilities
/// <summary> /// <summary>
/// A device that executes a sequence of actions with optional delays between actions /// A device that executes a sequence of actions with optional delays between actions
/// </summary> /// </summary>
[Description("A device that exectues a sequence of actions with optional delays between actions")] [Description("A device that executes a sequence of actions with optional delays between actions")]
public class ActionSequence : EssentialsDevice public class ActionSequence : EssentialsDevice
{ {
private ActionSequencePropertiesConfig _propertiesConfig; private ActionSequencePropertiesConfig _propertiesConfig;
@@ -47,6 +47,12 @@ namespace PepperDash.Essentials.Core.Utilities
/// </summary> /// </summary>
public void StartSequence() public void StartSequence()
{ {
if (_worker.ThreadState == Thread.eThreadStates.ThreadRunning)
{
Debug.Console(1, this, "Thread already running. Cannot Start Sequence");
return;
}
Debug.Console(1, this, "Starting Action Sequence"); Debug.Console(1, this, "Starting Action Sequence");
_allowActionsToExecute = true; _allowActionsToExecute = true;
AddActionsToQueue(); AddActionsToQueue();