mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-05 15:55:02 +00:00
feat(SigCommands): #759 Adds SigCommand concept for each data type
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user