Merge pull request #1279 from PepperDash/device-status-console

This commit is contained in:
Neil Dorin
2025-06-26 12:27:43 -06:00
committed by GitHub
3 changed files with 101 additions and 86 deletions

View File

@@ -99,11 +99,13 @@ namespace PepperDash.Core
public void PreActivate()
{
if (_PreActivationActions != null)
_PreActivationActions.ForEach(a => {
_PreActivationActions.ForEach(a =>
{
try
{
a.Invoke();
} catch (Exception e)
}
catch (Exception e)
{
Debug.LogMessage(e, "Error in PreActivationAction: " + e.Message, this);
}
@@ -131,7 +133,8 @@ namespace PepperDash.Core
public void PostActivate()
{
if (_PostActivationActions != null)
_PostActivationActions.ForEach(a => {
_PostActivationActions.ForEach(a =>
{
try
{
a.Invoke();
@@ -175,5 +178,15 @@ namespace PepperDash.Core
if (o is bool && !(bool)o) a();
}
/// <summary>
/// Returns a string representation of the object, including its key and name.
/// </summary>
/// <remarks>The returned string is formatted as "{Key} - {Name}". If the <c>Name</c> property is
/// null or empty, "---" is used in place of the name.</remarks>
/// <returns>A string that represents the object, containing the key and name in the format "{Key} - {Name}".</returns>
public override string ToString()
{
return string.Format("{0} - {1}", Key, string.IsNullOrEmpty(Name) ? "---" : Name);
}
}
}

View File

@@ -248,7 +248,7 @@ namespace PepperDash.Essentials.Core
foreach (var dev in Devices.Values.OfType<ICommunicationMonitor>())
{
CrestronConsole.ConsoleCommandResponse($"{dev}: {dev.CommunicationMonitor.Status}{Environment.NewLine}");
CrestronConsole.ConsoleCommandResponse($"{dev}: {dev.CommunicationMonitor.Status}\r\n");
}
}

View File

@@ -20,7 +20,8 @@ namespace PepperDash.Essentials.Core
public event EventHandler Initialized;
private bool _isInitialized;
public bool IsInitialized {
public bool IsInitialized
{
get { return _isInitialized; }
private set
{
@@ -80,7 +81,8 @@ namespace PepperDash.Essentials.Core
/// <summary>
/// Override this method to build and create custom Mobile Control Messengers during the Activation phase
/// </summary>
protected virtual void CreateMobileControlMessengers() {
protected virtual void CreateMobileControlMessengers()
{
}
}