From 657b9f1f5401b3ea6c7f664a6f1b4bb42608660f Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 28 Jan 2021 18:08:06 -0700 Subject: [PATCH] Adds summary help and Room ActivityComponentBase --- .../Interfaces/Components/RoomComponents.cs | 50 ++++++++++++- .../Room/Components/RoomComponentBase.cs | 73 +++++++++++++++++++ 2 files changed, 119 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Interfaces/Components/RoomComponents.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Interfaces/Components/RoomComponents.cs index f0a69467..aa57fc66 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Interfaces/Components/RoomComponents.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Interfaces/Components/RoomComponents.cs @@ -41,42 +41,81 @@ namespace PepperDash.Essentials.Core.Interfaces.Components /// public interface IRoomActivityComponent : IRoomComponent { + /// + /// Indicates if the component is enabled + /// BoolFeedback IsEnabledFeedback { get; } + /// + /// Set this value to enable or disable the component + /// bool Enable { set; } + /// + /// Label to be displayed for the activity on the UI + /// string Label { get; } + /// + /// Icon to be displayed for the activity on the UI + /// string Icon { get; } + /// + /// The component group that will be activated when this activty starts + /// IRoomBehaviourGroupComponent Component { get; } + /// + /// Determines the order the activities will be displayed on the UI + /// int Order { get; } + /// + /// Starts the activity + /// void StartActivity(); + /// + /// Ends the activity + /// void EndActivity(); } /// - /// Describes a room component that can be "used" by a user + /// Describes a room component that can be "activated" /// public interface IActivatableComponent : IRoomComponent { + /// + /// Indicates if the component is activated + /// BoolFeedback ActivatedFeedback { get; } + /// + /// Activates the component + /// void Activate(); + /// + /// Dactivates the component + /// void Deactivate(); } /// - /// Describes a room behaviour component. Is able to contain a collection of components that aggregate + /// Describes a group of room behaviour component. Is able to contain a collection of components that aggregate /// together to behave as one /// public interface IRoomBehaviourGroupComponent { + /// + /// A collection of components that work together to achieve a common behaviour + /// List Components { get; } void ActivateComponents(); void DeactivateComponents(); } + /// + /// Describes an individual room behaviour component + /// public interface IRoomBehaviourComponent : IActivatableComponent { @@ -84,10 +123,13 @@ namespace PepperDash.Essentials.Core.Interfaces.Components /// - /// Describes a room device component + /// Describes a room device component behaviour /// - public interface IRoomDeviceComponent : IActivatableComponent where T : EssentialsDevice + public interface IDeviceBehaviourComponent : IActivatableComponent where T : EssentialsDevice { + /// + /// The device this component applies behaviour to + /// T Device { get; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Components/RoomComponentBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Components/RoomComponentBase.cs index 19da5ffb..3dd00efb 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Components/RoomComponentBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/Components/RoomComponentBase.cs @@ -35,5 +35,78 @@ namespace PepperDash.Essentials.Core.Room.Components } + /// + /// The base class from which Room Activities should be derived + /// + public abstract class RoomActivityComponentBase : IRoomActivityComponent + { + + #region IRoomActivityComponent Members + + public BoolFeedback IsEnabledFeedback { get; private set; } + + private bool _enable; + + public bool Enable + { + set + { + if (value != _enable) + { + _enable = value; + IsEnabledFeedback.FireUpdate(); + } + } + } + + public string Label { get; private set; } + + public string Icon { get; private set; } + + public IRoomBehaviourGroupComponent Component { get; private set; } + + public int Order { get; private set; } + + #endregion + + #region IRoomComponent Members + + public IComponentRoom Parent { get; private set; } + + #endregion + + #region IKeyed Members + + private string _componentKey; + + public string Key + { + get + { + return Parent.Key + "-" + _componentKey; + } + } + + #endregion + + public RoomActivityComponentBase(string key, IComponentRoom parent) + { + _componentKey = key; + Parent = parent; + + IsEnabledFeedback = new BoolFeedback(() => _enable); + } + + public void StartActivity() + { + throw new NotImplementedException(); + } + + public void EndActivity() + { + throw new NotImplementedException(); + } + } + } \ No newline at end of file