feat(SigCommands): #759 Adds SigCommand concept for each data type

This commit is contained in:
Neil Dorin
2021-07-26 17:57:35 -06:00
parent 10f5516a5a
commit 83525b721b
7 changed files with 321 additions and 12 deletions

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
/// <summary>
/// A helper class to make it easier to work with Crestron Sigs
/// </summary>
public abstract class SigCommandBase : IKeyed
{
public string Key { get; private set; }
/// <summary>
/// Base Constructor - empty
/// </summary>
protected SigCommandBase()
{
}
protected SigCommandBase(string key)
{
if (key == null)
Key = "";
else
Key = key;
}
/// <summary>
/// Computes the value by running the ValueFunc and if the value has changed, updates the linked sigs and fires the OnOutputChange event
/// </summary>
public abstract void FireUpdate();
/// <summary>
/// Fires the update asynchronously within a CrestronInvoke
/// </summary>
public void InvokeFireUpdate()
{
CrestronInvoke.BeginInvoke(o => FireUpdate());
}
}
}