mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
feat(essentials): Updates to get scenarios to activate/deactivate
This commit is contained in:
@@ -171,8 +171,22 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (value != _currentScenario)
|
if (value != _currentScenario)
|
||||||
{
|
{
|
||||||
|
// Deactivate the old scenario first
|
||||||
|
if (_currentScenario != null)
|
||||||
|
{
|
||||||
|
_currentScenario.Deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
_currentScenario = value;
|
_currentScenario = value;
|
||||||
|
|
||||||
|
// Activate the new scenario
|
||||||
|
if (_currentScenario != null)
|
||||||
|
{
|
||||||
|
_currentScenario.Activate();
|
||||||
|
|
||||||
Debug.Console(1, this, "Current Scenario: {0}", _currentScenario.Name);
|
Debug.Console(1, this, "Current Scenario: {0}", _currentScenario.Name);
|
||||||
|
}
|
||||||
|
|
||||||
var handler = RoomCombinationScenarioChanged;
|
var handler = RoomCombinationScenarioChanged;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void Activate();
|
void Activate();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deactivates this room combination scenario
|
||||||
|
/// </summary>
|
||||||
|
void Deactivate();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The state of the partitions that would activate this scenario
|
/// The state of the partitions that would activate this scenario
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
@@ -27,9 +29,9 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public BoolFeedback IsActiveFeedback { get; private set; }
|
public BoolFeedback IsActiveFeedback { get; private set; }
|
||||||
|
|
||||||
List<DeviceActionWrapper> activationActions;
|
private List<DeviceActionWrapper> activationActions;
|
||||||
|
|
||||||
List<DeviceActionWrapper> deactivationActions;
|
private List<DeviceActionWrapper> deactivationActions;
|
||||||
|
|
||||||
public RoomCombinationScenario(RoomCombinationScenarioConfig config)
|
public RoomCombinationScenario(RoomCombinationScenarioConfig config)
|
||||||
{
|
{
|
||||||
@@ -52,6 +54,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public void Activate()
|
public void Activate()
|
||||||
{
|
{
|
||||||
|
Debug.Console(1, "Activating Scenario: '{0}' with {1} action(s) defined", Name, activationActions.Count);
|
||||||
|
|
||||||
if (activationActions != null)
|
if (activationActions != null)
|
||||||
{
|
{
|
||||||
foreach (var action in activationActions)
|
foreach (var action in activationActions)
|
||||||
@@ -66,6 +70,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
{
|
{
|
||||||
|
Debug.Console(1, "Deactivating Scenario: '{0}' with {1} action(s) defined", Name, deactivationActions.Count);
|
||||||
|
|
||||||
if (deactivationActions != null)
|
if (deactivationActions != null)
|
||||||
{
|
{
|
||||||
foreach (var action in deactivationActions)
|
foreach (var action in deactivationActions)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="PepperDashCore" version="1.0.48" targetFramework="net35" allowedVersions="[1.0,1.1)"/>
|
<package id="PepperDashCore" version="1.1.0" targetFramework="net35" allowedVersions="[1.0,1.1)"/>
|
||||||
</packages>
|
</packages>
|
||||||
Reference in New Issue
Block a user