mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 20:47:04 +00:00
fix: mark FeedbackBase default constructor as obsolete
There are situations now where feedbacks in the feedback collection can be used to update things on UIs. If the feedback doesn't have a key, it can't be used for this purpose.
This commit is contained in:
parent
f0af9f8d19
commit
dc7f99e176
4 changed files with 59 additions and 47 deletions
|
|
@ -9,45 +9,54 @@ using PepperDash.Core;
|
|||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
public abstract class Feedback : IKeyed
|
||||
{
|
||||
public event EventHandler<FeedbackEventArgs> OutputChange;
|
||||
/// <summary>
|
||||
/// Base class for all feedback types
|
||||
/// </summary>
|
||||
public abstract class Feedback : IKeyed
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when the output value changes
|
||||
/// </summary>
|
||||
public event EventHandler<FeedbackEventArgs> OutputChange;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
public string Key { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the BoolValue
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public virtual bool BoolValue { get { return false; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the IntValue
|
||||
/// </summary>
|
||||
public virtual int IntValue { get { return 0; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the StringValue
|
||||
/// </summary>
|
||||
public virtual string StringValue { get { return ""; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the BoolValue
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public virtual bool BoolValue { get { return false; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the IntValue
|
||||
/// </summary>
|
||||
public virtual int IntValue { get { return 0; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the StringValue
|
||||
/// </summary>
|
||||
public virtual string StringValue { get { return ""; } }
|
||||
/// <summary>
|
||||
/// Gets or sets the SerialValue
|
||||
/// </summary>
|
||||
public virtual string SerialValue { get { return ""; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the InTestMode
|
||||
/// </summary>
|
||||
public bool InTestMode { get; protected set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the InTestMode
|
||||
/// </summary>
|
||||
public bool InTestMode { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Base Constructor - empty
|
||||
/// </summary>
|
||||
protected Feedback()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Base Constructor - empty
|
||||
/// </summary>
|
||||
[Obsolete("use constructor with Key parameter. This constructor will be removed in a future version")]
|
||||
protected Feedback() : this(null) { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with Key parameter
|
||||
/// </summary>
|
||||
/// <param name="key">The key for the feedback</param>
|
||||
protected Feedback(string key)
|
||||
{
|
||||
if (key == null)
|
||||
|
|
@ -58,27 +67,27 @@ namespace PepperDash.Essentials.Core
|
|||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ClearTestValue method
|
||||
/// </summary>
|
||||
public void ClearTestValue()
|
||||
{
|
||||
InTestMode = false;
|
||||
FireUpdate();
|
||||
}
|
||||
/// <summary>
|
||||
/// ClearTestValue method
|
||||
/// </summary>
|
||||
public void ClearTestValue()
|
||||
{
|
||||
InTestMode = false;
|
||||
FireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fires an update synchronously
|
||||
/// </summary>
|
||||
public abstract void FireUpdate();
|
||||
/// <summary>
|
||||
/// Fires an update synchronously
|
||||
/// </summary>
|
||||
public abstract void FireUpdate();
|
||||
|
||||
/// <summary>
|
||||
/// Fires the update asynchronously within a CrestronInvoke
|
||||
/// </summary>
|
||||
public void InvokeFireUpdate()
|
||||
{
|
||||
CrestronInvoke.BeginInvoke(o => FireUpdate());
|
||||
}
|
||||
/// <summary>
|
||||
/// Fires the update asynchronously within a CrestronInvoke
|
||||
/// </summary>
|
||||
public void InvokeFireUpdate()
|
||||
{
|
||||
CrestronInvoke.BeginInvoke(o => FireUpdate());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method that fires event. Use this intstead of calling OutputChange
|
||||
|
|
@ -103,5 +112,5 @@ namespace PepperDash.Essentials.Core
|
|||
{
|
||||
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue