mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-10 02:05:08 +00:00
Brings in changes from On Prem BB repo. Resolves ecs-756/757/758/759
This commit is contained in:
@@ -1,251 +1,256 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
using PepperDash.Essentials.Core.Lighting;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsEnvironmentDriver : PanelDriverBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Do I need this here?
|
||||
/// </summary>
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
|
||||
/// <summary>
|
||||
/// The list of devices this driver is responsible for controlling
|
||||
/// </summary>
|
||||
public List<IKeyed> Devices { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The parent driver for this
|
||||
/// </summary>
|
||||
EssentialsPanelMainInterfaceDriver Parent;
|
||||
|
||||
/// <summary>
|
||||
/// The list of sub drivers for the devices
|
||||
/// </summary>
|
||||
public List<PanelDriverBase> DeviceSubDrivers { get; private set; }
|
||||
|
||||
public uint BackgroundSubpageJoin { get; private set; }
|
||||
|
||||
public EssentialsEnvironmentDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
Config = config;
|
||||
Parent = parent;
|
||||
|
||||
Devices = new List<IKeyed>();
|
||||
DeviceSubDrivers = new List<PanelDriverBase>();
|
||||
|
||||
Parent.AvDriver.PopupInterlock.IsShownFeedback.OutputChange += IsShownFeedback_OutputChange;
|
||||
|
||||
// Calculate the join offests for each device page and assign join actions for each button
|
||||
}
|
||||
|
||||
void IsShownFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
// Hide this driver and all sub drivers if popup interlock is not shown
|
||||
if (Parent.AvDriver.PopupInterlock.IsShownFeedback.BoolValue == false)
|
||||
{
|
||||
foreach (var driver in DeviceSubDrivers)
|
||||
{
|
||||
driver.Hide();
|
||||
}
|
||||
|
||||
base.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows this driver and all sub drivers
|
||||
/// </summary>
|
||||
public override void Show()
|
||||
{
|
||||
Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(BackgroundSubpageJoin);
|
||||
|
||||
foreach (var driver in DeviceSubDrivers)
|
||||
{
|
||||
driver.Show();
|
||||
}
|
||||
|
||||
base.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides this driver and all sub drivers
|
||||
/// </summary>
|
||||
public override void Hide()
|
||||
{
|
||||
Parent.AvDriver.PopupInterlock.HideAndClear();
|
||||
|
||||
foreach (var driver in DeviceSubDrivers)
|
||||
{
|
||||
driver.Hide();
|
||||
}
|
||||
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
public override void Toggle()
|
||||
{
|
||||
if (IsVisible)
|
||||
Hide();
|
||||
else
|
||||
Show();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reads the device keys from the config and gets the devices by key
|
||||
/// </summary>
|
||||
public void GetDevicesFromConfig(Room.Config.EssentialsEnvironmentPropertiesConfig EnvironmentPropertiesConfig)
|
||||
{
|
||||
if (EnvironmentPropertiesConfig != null)
|
||||
{
|
||||
Devices.Clear();
|
||||
DeviceSubDrivers.Clear();
|
||||
|
||||
uint column = 1;
|
||||
|
||||
foreach (var dKey in EnvironmentPropertiesConfig.DeviceKeys)
|
||||
{
|
||||
var device = DeviceManager.GetDeviceForKey(dKey);
|
||||
|
||||
if (device != null)
|
||||
{
|
||||
// Build the driver
|
||||
var devicePanelDriver = GetPanelDriverForDevice(device, column);
|
||||
|
||||
// Add new PanelDriverBase SubDriver
|
||||
if (devicePanelDriver != null)
|
||||
{
|
||||
Devices.Add(device);
|
||||
DeviceSubDrivers.Add(devicePanelDriver);
|
||||
|
||||
Debug.Console(1, "Adding '{0}' to Environment Devices", device.Key);
|
||||
|
||||
column++;
|
||||
|
||||
|
||||
// Quit if device count is exceeded
|
||||
if (column > 4)
|
||||
break;
|
||||
}
|
||||
else
|
||||
Debug.Console(1, "Unable to build environment driver for device: '{0}'", device.Key);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SetupEnvironmentUiJoins();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, "Unable to get devices from config. No EnvironmentPropertiesConfig object in room config");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the appropriate panel driver for the device
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="column"></param>
|
||||
/// <returns></returns>
|
||||
PanelDriverBase GetPanelDriverForDevice(IKeyed device, uint column)
|
||||
{
|
||||
PanelDriverBase panelDriver = null;
|
||||
|
||||
uint buttonPressJoinBase = 0;
|
||||
uint buttonVisibleJoinBase = 0;
|
||||
uint stringJoinBase = 0;
|
||||
uint shadeTypeVisibleBase = 0;
|
||||
uint lightingTypeVisibleBase = 0;
|
||||
|
||||
switch (column)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnOneButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnOneButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnOneLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnOneShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnOneLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnTwoButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnTwoButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnTwoLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnTwoShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnTwoLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnThreeButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnThreeButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnThreeLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnThreeShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnThreeLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnFourButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnFourButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnFourLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnFourShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnFourLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Debug.Console(1, "Environment Driver: Invalid column number specified");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if device is a shade or lighting type and construct the appropriate driver
|
||||
if (device is ShadeBase)
|
||||
{
|
||||
panelDriver = new EssentialsShadeDriver(this, device.Key, buttonPressJoinBase, stringJoinBase, shadeTypeVisibleBase);
|
||||
}
|
||||
else if (device is LightingBase)
|
||||
{
|
||||
panelDriver = new EssentialsLightingDriver(this, device.Key, buttonPressJoinBase, buttonVisibleJoinBase, stringJoinBase, lightingTypeVisibleBase);
|
||||
}
|
||||
|
||||
// Return the driver
|
||||
|
||||
return panelDriver;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the join values for the generic environment subpages
|
||||
/// </summary>
|
||||
void SetupEnvironmentUiJoins()
|
||||
{
|
||||
// Calculate which background subpage join to use
|
||||
BackgroundSubpageJoin = UIBoolJoin.EnvironmentBackgroundSubpageVisibleBase + (uint)DeviceSubDrivers.Count;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface IEnvironmentSubdriver
|
||||
{
|
||||
uint SubpageVisibleJoin { get; }
|
||||
}
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Shades;
|
||||
using PepperDash.Essentials.Core.Lighting;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsEnvironmentDriver : PanelDriverBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Do I need this here?
|
||||
/// </summary>
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
|
||||
/// <summary>
|
||||
/// The list of devices this driver is responsible for controlling
|
||||
/// </summary>
|
||||
public List<IKeyed> Devices { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The parent driver for this
|
||||
/// </summary>
|
||||
EssentialsPanelMainInterfaceDriver Parent;
|
||||
|
||||
/// <summary>
|
||||
/// The list of sub drivers for the devices
|
||||
/// </summary>
|
||||
public List<PanelDriverBase> DeviceSubDrivers { get; private set; }
|
||||
|
||||
public uint BackgroundSubpageJoin { get; private set; }
|
||||
|
||||
public EssentialsEnvironmentDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
Config = config;
|
||||
Parent = parent;
|
||||
|
||||
Devices = new List<IKeyed>();
|
||||
DeviceSubDrivers = new List<PanelDriverBase>();
|
||||
|
||||
Parent.AvDriver.PopupInterlock.StatusChanged += new EventHandler<StatusChangedEventArgs>(PopupInterlock_CurrentJoinChanged);
|
||||
|
||||
// Calculate the join offests for each device page and assign join actions for each button
|
||||
}
|
||||
|
||||
void PopupInterlock_CurrentJoinChanged(object sender, StatusChangedEventArgs e)
|
||||
{
|
||||
// Hide this driver and all sub drivers if popup interlock is not shown
|
||||
if (!e.IsShown || e.NewJoin != BackgroundSubpageJoin)
|
||||
{
|
||||
foreach (var driver in DeviceSubDrivers)
|
||||
{
|
||||
driver.Hide();
|
||||
}
|
||||
|
||||
base.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
void IsShownFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shows this driver and all sub drivers
|
||||
/// </summary>
|
||||
public override void Show()
|
||||
{
|
||||
Parent.AvDriver.PopupInterlock.ShowInterlocked(BackgroundSubpageJoin);
|
||||
|
||||
foreach (var driver in DeviceSubDrivers)
|
||||
{
|
||||
driver.Show();
|
||||
}
|
||||
|
||||
base.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides this driver and all sub drivers
|
||||
/// </summary>
|
||||
public override void Hide()
|
||||
{
|
||||
Parent.AvDriver.PopupInterlock.HideAndClear();
|
||||
|
||||
foreach (var driver in DeviceSubDrivers)
|
||||
{
|
||||
driver.Hide();
|
||||
}
|
||||
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
public override void Toggle()
|
||||
{
|
||||
if (IsVisible)
|
||||
Hide();
|
||||
else
|
||||
Show();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reads the device keys from the config and gets the devices by key
|
||||
/// </summary>
|
||||
public void GetDevicesFromConfig(Room.Config.EssentialsEnvironmentPropertiesConfig EnvironmentPropertiesConfig)
|
||||
{
|
||||
if (EnvironmentPropertiesConfig != null)
|
||||
{
|
||||
Devices.Clear();
|
||||
DeviceSubDrivers.Clear();
|
||||
|
||||
uint column = 1;
|
||||
|
||||
foreach (var dKey in EnvironmentPropertiesConfig.DeviceKeys)
|
||||
{
|
||||
var device = DeviceManager.GetDeviceForKey(dKey);
|
||||
|
||||
if (device != null)
|
||||
{
|
||||
// Build the driver
|
||||
var devicePanelDriver = GetPanelDriverForDevice(device, column);
|
||||
|
||||
// Add new PanelDriverBase SubDriver
|
||||
if (devicePanelDriver != null)
|
||||
{
|
||||
Devices.Add(device);
|
||||
DeviceSubDrivers.Add(devicePanelDriver);
|
||||
|
||||
Debug.Console(1, "Adding '{0}' to Environment Devices", device.Key);
|
||||
|
||||
column++;
|
||||
|
||||
|
||||
// Quit if device count is exceeded
|
||||
if (column > 4)
|
||||
break;
|
||||
}
|
||||
else
|
||||
Debug.Console(1, "Unable to build environment driver for device: '{0}'", device.Key);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SetupEnvironmentUiJoins();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Console(1, "Unable to get devices from config. No EnvironmentPropertiesConfig object in room config");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the appropriate panel driver for the device
|
||||
/// </summary>
|
||||
/// <param name="device"></param>
|
||||
/// <param name="column"></param>
|
||||
/// <returns></returns>
|
||||
PanelDriverBase GetPanelDriverForDevice(IKeyed device, uint column)
|
||||
{
|
||||
PanelDriverBase panelDriver = null;
|
||||
|
||||
uint buttonPressJoinBase = 0;
|
||||
uint buttonVisibleJoinBase = 0;
|
||||
uint stringJoinBase = 0;
|
||||
uint shadeTypeVisibleBase = 0;
|
||||
uint lightingTypeVisibleBase = 0;
|
||||
|
||||
switch (column)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnOneButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnOneButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnOneLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnOneShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnOneLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnTwoButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnTwoButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnTwoLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnTwoShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnTwoLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnThreeButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnThreeButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnThreeLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnThreeShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnThreeLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
buttonPressJoinBase = UIBoolJoin.EnvironmentColumnFourButtonPressBase;
|
||||
buttonVisibleJoinBase = UIBoolJoin.EnvironmentColumnFourButtonVisibleBase;
|
||||
stringJoinBase = UIStringJoin.EnvironmentColumnFourLabelBase;
|
||||
shadeTypeVisibleBase = UIBoolJoin.EnvironmentColumnFourShadingTypeVisibleBase;
|
||||
lightingTypeVisibleBase = UIBoolJoin.EnvironmentColumnFourLightingTypeVisibleBase;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Debug.Console(1, "Environment Driver: Invalid column number specified");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if device is a shade or lighting type and construct the appropriate driver
|
||||
if (device is ShadeBase)
|
||||
{
|
||||
panelDriver = new EssentialsShadeDriver(this, device.Key, buttonPressJoinBase, stringJoinBase, shadeTypeVisibleBase);
|
||||
}
|
||||
else if (device is LightingBase)
|
||||
{
|
||||
panelDriver = new EssentialsLightingDriver(this, device.Key, buttonPressJoinBase, buttonVisibleJoinBase, stringJoinBase, lightingTypeVisibleBase);
|
||||
}
|
||||
|
||||
// Return the driver
|
||||
|
||||
return panelDriver;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the join values for the generic environment subpages
|
||||
/// </summary>
|
||||
void SetupEnvironmentUiJoins()
|
||||
{
|
||||
// Calculate which background subpage join to use
|
||||
BackgroundSubpageJoin = UIBoolJoin.EnvironmentBackgroundSubpageVisibleBase + (uint)DeviceSubDrivers.Count;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface IEnvironmentSubdriver
|
||||
{
|
||||
uint SubpageVisibleJoin { get; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,266 +1,371 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.PageManagers;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsHeaderDriver : PanelDriverBase
|
||||
{
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
|
||||
/// <summary>
|
||||
/// The parent driver for this
|
||||
/// </summary>
|
||||
EssentialsPanelMainInterfaceDriver Parent;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the SetHeaderButtons method has completed successfully
|
||||
/// </summary>
|
||||
public bool HeaderButtonsAreSetUp { get; private set; }
|
||||
|
||||
StringInputSig HeaderCallButtonIconSig;
|
||||
|
||||
public EssentialsHeaderDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
Config = config;
|
||||
Parent = parent;
|
||||
}
|
||||
|
||||
void SetUpGear(IAVDriver avDriver, EssentialsRoomBase currentRoom)
|
||||
{
|
||||
// Gear
|
||||
TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear");
|
||||
TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000,
|
||||
avDriver.ShowTech,
|
||||
null,
|
||||
() =>
|
||||
{
|
||||
if (currentRoom.OnFeedback.BoolValue)
|
||||
avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible);
|
||||
else
|
||||
avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible);
|
||||
});
|
||||
TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
|
||||
avDriver.PopupInterlock.HideAndClear());
|
||||
}
|
||||
|
||||
void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
|
||||
{
|
||||
// Help roomConf and popup
|
||||
if (roomConf.Help != null)
|
||||
{
|
||||
TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message);
|
||||
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton);
|
||||
TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText);
|
||||
if (roomConf.Help.ShowCallButton)
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN
|
||||
else
|
||||
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
|
||||
}
|
||||
else // older config
|
||||
{
|
||||
TriList.SetString(UIStringJoin.HelpMessage, roomConf.HelpMessage);
|
||||
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false);
|
||||
TriList.SetString(UIStringJoin.HelpPageCallButtonText, null);
|
||||
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
|
||||
}
|
||||
TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help");
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () =>
|
||||
{
|
||||
string message = null;
|
||||
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
|
||||
as EssentialsHuddleSpaceRoom;
|
||||
if (room != null)
|
||||
message = room.Config.HelpMessage;
|
||||
else
|
||||
message = "Sorry, no help message available. No room connected.";
|
||||
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
|
||||
Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible);
|
||||
});
|
||||
}
|
||||
|
||||
uint SetUpEnvironmentButton(EssentialsEnvironmentDriver environmentDriver, uint nextJoin)
|
||||
{
|
||||
if (environmentDriver != null)
|
||||
{
|
||||
TriList.SetString(nextJoin, "Lights");
|
||||
TriList.SetSigFalseAction(nextJoin, environmentDriver.Toggle);
|
||||
nextJoin--;
|
||||
return nextJoin;
|
||||
}
|
||||
else
|
||||
return nextJoin;
|
||||
}
|
||||
|
||||
uint SetUpCalendarButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin)
|
||||
{
|
||||
// Calendar button
|
||||
if (avDriver.CurrentRoom.ScheduleSource != null)
|
||||
{
|
||||
TriList.SetString(nextJoin, "Calendar");
|
||||
TriList.SetSigFalseAction(nextJoin, avDriver.CalendarPress);
|
||||
|
||||
nextJoin--;
|
||||
return nextJoin;
|
||||
}
|
||||
else
|
||||
return nextJoin;
|
||||
}
|
||||
|
||||
uint SetUpCallButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin)
|
||||
{
|
||||
// Call button
|
||||
TriList.SetString(nextJoin, "DND");
|
||||
TriList.SetSigFalseAction(nextJoin, avDriver.ShowActiveCallsList);
|
||||
HeaderCallButtonIconSig = TriList.StringInput[nextJoin];
|
||||
|
||||
nextJoin--;
|
||||
return nextJoin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the call status and sets the icon mode and text label
|
||||
/// </summary>
|
||||
public void ComputeHeaderCallStatus(VideoCodecBase codec)
|
||||
{
|
||||
if (codec == null)
|
||||
{
|
||||
Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (HeaderCallButtonIconSig == null)
|
||||
{
|
||||
Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// Set mode of header button
|
||||
if (!codec.IsInCall)
|
||||
{
|
||||
HeaderCallButtonIconSig.StringValue = "DND";
|
||||
//HeaderCallButton.SetIcon(HeaderListButton.OnHook);
|
||||
}
|
||||
else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video))
|
||||
HeaderCallButtonIconSig.StringValue = "Misc-06_Dark";
|
||||
//HeaderCallButton.SetIcon(HeaderListButton.Camera);
|
||||
//TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2);
|
||||
else
|
||||
HeaderCallButtonIconSig.StringValue = "Misc-09_Dark";
|
||||
//HeaderCallButton.SetIcon(HeaderListButton.Phone);
|
||||
//TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1);
|
||||
|
||||
// Set the call status text
|
||||
if (codec.ActiveCalls.Count > 0)
|
||||
{
|
||||
if (codec.ActiveCalls.Count == 1)
|
||||
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call");
|
||||
else if (codec.ActiveCalls.Count > 1)
|
||||
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count));
|
||||
}
|
||||
else
|
||||
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets up Header Buttons for the EssentialsHuddleVtc1Room type
|
||||
/// </summary>
|
||||
public void SetupHeaderButtons(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, EssentialsHuddleVtc1Room currentRoom)
|
||||
{
|
||||
HeaderButtonsAreSetUp = false;
|
||||
|
||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||
|
||||
var roomConf = currentRoom.Config;
|
||||
|
||||
SetUpGear(avDriver, currentRoom);
|
||||
|
||||
SetUpHelpButton(roomConf);
|
||||
|
||||
uint nextJoin = 3953;
|
||||
|
||||
nextJoin = SetUpEnvironmentButton(Parent.EnvironmentDriver, nextJoin);
|
||||
|
||||
nextJoin = SetUpCalendarButton(avDriver, nextJoin);
|
||||
|
||||
nextJoin = SetUpCallButton(avDriver, nextJoin);
|
||||
|
||||
// blank any that remain
|
||||
for (var i = nextJoin; i > 3950; i--)
|
||||
{
|
||||
TriList.SetString(i, "Blank");
|
||||
TriList.SetSigFalseAction(i, () => { });
|
||||
}
|
||||
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, avDriver.ShowActiveCallsList);
|
||||
|
||||
// Set Call Status Subpage Position
|
||||
|
||||
if (nextJoin == 3951)
|
||||
{
|
||||
// Set to right position
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false);
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true);
|
||||
}
|
||||
else if (nextJoin == 3950)
|
||||
{
|
||||
// Set to left position
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true);
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false);
|
||||
}
|
||||
|
||||
HeaderButtonsAreSetUp = true;
|
||||
|
||||
ComputeHeaderCallStatus(currentRoom.VideoCodec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets up Header Buttons for the EssentialsHuddleSpaceRoom type
|
||||
/// </summary>
|
||||
public void SetupHeaderButtons(EssentialsHuddlePanelAvFunctionsDriver avDriver, EssentialsHuddleSpaceRoom currentRoom)
|
||||
{
|
||||
HeaderButtonsAreSetUp = false;
|
||||
|
||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||
|
||||
var roomConf = currentRoom.Config;
|
||||
|
||||
SetUpGear(avDriver, currentRoom);
|
||||
|
||||
SetUpHelpButton(roomConf);
|
||||
|
||||
uint nextJoin = 3953;
|
||||
|
||||
nextJoin = SetUpEnvironmentButton(Parent.EnvironmentDriver, nextJoin);
|
||||
|
||||
// blank any that remain
|
||||
for (var i = nextJoin; i > 3950; i--)
|
||||
{
|
||||
TriList.SetString(i, "Blank");
|
||||
TriList.SetSigFalseAction(i, () => { });
|
||||
}
|
||||
|
||||
HeaderButtonsAreSetUp = true;
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.PageManagers;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
using PepperDash.Essentials.Devices.Common.Codec;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsHeaderDriver : PanelDriverBase
|
||||
{
|
||||
uint EnvironmentCaretVisible;
|
||||
uint CalendarCaretVisible;
|
||||
uint CallCaretVisible;
|
||||
|
||||
JoinedSigInterlock CaretInterlock;
|
||||
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
|
||||
/// <summary>
|
||||
/// The parent driver for this
|
||||
/// </summary>
|
||||
EssentialsPanelMainInterfaceDriver Parent;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the SetHeaderButtons method has completed successfully
|
||||
/// </summary>
|
||||
public bool HeaderButtonsAreSetUp { get; private set; }
|
||||
|
||||
StringInputSig HeaderCallButtonIconSig;
|
||||
|
||||
public EssentialsHeaderDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
Config = config;
|
||||
Parent = parent;
|
||||
CaretInterlock = new JoinedSigInterlock(TriList);
|
||||
}
|
||||
|
||||
void SetUpGear(IAVDriver avDriver, EssentialsRoomBase currentRoom)
|
||||
{
|
||||
// Gear
|
||||
TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear");
|
||||
TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000,
|
||||
avDriver.ShowTech,
|
||||
null,
|
||||
() =>
|
||||
{
|
||||
if (currentRoom.OnFeedback.BoolValue)
|
||||
{
|
||||
avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible);
|
||||
CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret5Visible);
|
||||
}
|
||||
else
|
||||
{
|
||||
avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible);
|
||||
CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret5Visible);
|
||||
}
|
||||
});
|
||||
TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
|
||||
avDriver.PopupInterlock.HideAndClear());
|
||||
}
|
||||
|
||||
void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
|
||||
{
|
||||
// Help roomConf and popup
|
||||
if (roomConf.Help != null)
|
||||
{
|
||||
TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message);
|
||||
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton);
|
||||
TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText);
|
||||
if (roomConf.Help.ShowCallButton)
|
||||
{
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
|
||||
}
|
||||
}
|
||||
else // older config
|
||||
{
|
||||
TriList.SetString(UIStringJoin.HelpMessage, roomConf.HelpMessage);
|
||||
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false);
|
||||
TriList.SetString(UIStringJoin.HelpPageCallButtonText, null);
|
||||
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
|
||||
}
|
||||
TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help");
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () =>
|
||||
{
|
||||
string message = null;
|
||||
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
|
||||
as EssentialsHuddleSpaceRoom;
|
||||
if (room != null)
|
||||
message = room.Config.HelpMessage;
|
||||
else
|
||||
message = "Sorry, no help message available. No room connected.";
|
||||
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
|
||||
Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible);
|
||||
CaretInterlock.ShowInterlocked(UIBoolJoin.HeaderCaret4Visible);
|
||||
});
|
||||
}
|
||||
|
||||
uint SetUpEnvironmentButton(EssentialsEnvironmentDriver environmentDriver, uint nextJoin)
|
||||
{
|
||||
if (environmentDriver != null)
|
||||
{
|
||||
var tempJoin = nextJoin;
|
||||
TriList.SetString(tempJoin, "Lights");
|
||||
EnvironmentCaretVisible = tempJoin + 10;
|
||||
TriList.SetSigFalseAction(tempJoin, () =>
|
||||
{
|
||||
environmentDriver.Toggle();
|
||||
CaretInterlock.ShowInterlocked(EnvironmentCaretVisible);
|
||||
});
|
||||
nextJoin--;
|
||||
return nextJoin;
|
||||
}
|
||||
else
|
||||
return nextJoin;
|
||||
}
|
||||
|
||||
uint SetUpCalendarButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin)
|
||||
{
|
||||
// Calendar button
|
||||
if (avDriver.CurrentRoom.ScheduleSource != null)
|
||||
{
|
||||
var tempJoin = nextJoin;
|
||||
TriList.SetString(tempJoin, "Calendar");
|
||||
CalendarCaretVisible = tempJoin + 10;
|
||||
TriList.SetSigFalseAction(tempJoin, () =>
|
||||
{
|
||||
avDriver.CalendarPress();
|
||||
CaretInterlock.ShowInterlocked(CalendarCaretVisible);
|
||||
});
|
||||
|
||||
nextJoin--;
|
||||
return nextJoin;
|
||||
}
|
||||
else
|
||||
return nextJoin;
|
||||
}
|
||||
|
||||
uint SetUpCallButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin)
|
||||
{
|
||||
// Call button
|
||||
var tempJoin = nextJoin;
|
||||
TriList.SetString(tempJoin, "DND");
|
||||
CallCaretVisible = tempJoin + 10;
|
||||
TriList.SetSigFalseAction(tempJoin, () =>
|
||||
{
|
||||
avDriver.ShowActiveCallsList();
|
||||
if(avDriver.CurrentRoom.InCallFeedback.BoolValue)
|
||||
CaretInterlock.ShowInterlocked(CallCaretVisible);
|
||||
});
|
||||
HeaderCallButtonIconSig = TriList.StringInput[tempJoin];
|
||||
|
||||
nextJoin--;
|
||||
return nextJoin;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evaluates the call status and sets the icon mode and text label
|
||||
/// </summary>
|
||||
public void ComputeHeaderCallStatus(VideoCodecBase codec)
|
||||
{
|
||||
if (codec == null)
|
||||
{
|
||||
Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (HeaderCallButtonIconSig == null)
|
||||
{
|
||||
Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// Set mode of header button
|
||||
if (!codec.IsInCall)
|
||||
{
|
||||
HeaderCallButtonIconSig.StringValue = "DND";
|
||||
//HeaderCallButton.SetIcon(HeaderListButton.OnHook);
|
||||
}
|
||||
else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video))
|
||||
HeaderCallButtonIconSig.StringValue = "Misc-06_Dark";
|
||||
//HeaderCallButton.SetIcon(HeaderListButton.Camera);
|
||||
//TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2);
|
||||
else
|
||||
HeaderCallButtonIconSig.StringValue = "Misc-09_Dark";
|
||||
//HeaderCallButton.SetIcon(HeaderListButton.Phone);
|
||||
//TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1);
|
||||
|
||||
// Set the call status text
|
||||
if (codec.ActiveCalls.Count > 0)
|
||||
{
|
||||
if (codec.ActiveCalls.Count == 1)
|
||||
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call");
|
||||
else if (codec.ActiveCalls.Count > 1)
|
||||
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count));
|
||||
}
|
||||
else
|
||||
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets up Header Buttons for the EssentialsHuddleVtc1Room type
|
||||
/// </summary>
|
||||
public void SetupHeaderButtons(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, EssentialsHuddleVtc1Room currentRoom)
|
||||
{
|
||||
HeaderButtonsAreSetUp = false;
|
||||
|
||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||
|
||||
var roomConf = currentRoom.Config;
|
||||
|
||||
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
||||
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
||||
Parent.AvDriver.PopupInterlock.StatusChanged += PopupInterlock_StatusChanged;
|
||||
|
||||
SetUpGear(avDriver, currentRoom);
|
||||
|
||||
SetUpHelpButton(roomConf);
|
||||
|
||||
uint nextJoin = 3953;
|
||||
|
||||
nextJoin = SetUpEnvironmentButton(Parent.EnvironmentDriver, nextJoin);
|
||||
|
||||
nextJoin = SetUpCalendarButton(avDriver, nextJoin);
|
||||
|
||||
nextJoin = SetUpCallButton(avDriver, nextJoin);
|
||||
|
||||
// blank any that remain
|
||||
for (var i = nextJoin; i > 3950; i--)
|
||||
{
|
||||
TriList.SetString(i, "Blank");
|
||||
TriList.SetSigFalseAction(i, () => { });
|
||||
}
|
||||
|
||||
TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress,
|
||||
() =>
|
||||
{
|
||||
avDriver.ShowActiveCallsList();
|
||||
if (avDriver.CurrentRoom.InCallFeedback.BoolValue)
|
||||
CaretInterlock.ShowInterlocked(CallCaretVisible);
|
||||
});
|
||||
|
||||
// Set Call Status Subpage Position
|
||||
|
||||
if (nextJoin == 3951)
|
||||
{
|
||||
// Set to right position
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false);
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true);
|
||||
}
|
||||
else if (nextJoin == 3950)
|
||||
{
|
||||
// Set to left position
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true);
|
||||
TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false);
|
||||
}
|
||||
|
||||
HeaderButtonsAreSetUp = true;
|
||||
|
||||
ComputeHeaderCallStatus(currentRoom.VideoCodec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets up Header Buttons for the EssentialsHuddleSpaceRoom type
|
||||
/// </summary>
|
||||
public void SetupHeaderButtons(EssentialsHuddlePanelAvFunctionsDriver avDriver, EssentialsHuddleSpaceRoom currentRoom)
|
||||
{
|
||||
HeaderButtonsAreSetUp = false;
|
||||
|
||||
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
|
||||
|
||||
var roomConf = currentRoom.Config;
|
||||
|
||||
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
|
||||
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
|
||||
Parent.AvDriver.PopupInterlock.StatusChanged += PopupInterlock_StatusChanged;
|
||||
|
||||
SetUpGear(avDriver, currentRoom);
|
||||
|
||||
SetUpHelpButton(roomConf);
|
||||
|
||||
uint nextJoin = 3953;
|
||||
|
||||
nextJoin = SetUpEnvironmentButton(Parent.EnvironmentDriver, nextJoin);
|
||||
|
||||
// blank any that remain
|
||||
for (var i = nextJoin; i > 3950; i--)
|
||||
{
|
||||
TriList.SetString(i, "Blank");
|
||||
TriList.SetSigFalseAction(i, () => { });
|
||||
}
|
||||
|
||||
HeaderButtonsAreSetUp = true;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Whenever a popup is shown/hidden, show/hide the header carets subpage and set the visibility of the correct caret
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
//void IsShownFeedback_OutputChange(object sender, EventArgs e)
|
||||
//{
|
||||
// var popupInterlockIsShown = Parent.AvDriver.PopupInterlock.IsShown;
|
||||
// // Set the visible state for the HeaderPopupCaretsSubpage to match that of the PopupInterlock state
|
||||
// TriList.SetBool(UIBoolJoin.HeaderPopupCaretsSubpageVisibile, popupInterlockIsShown);
|
||||
|
||||
// // Clear all caret visibility
|
||||
// for (uint i = UIBoolJoin.HeaderCaret5Visible; i >= UIBoolJoin.HeaderCaret1Visible; i--)
|
||||
// {
|
||||
// TriList.SetBool(i, false);
|
||||
// }
|
||||
|
||||
// // Set the current caret visible if the popup is still shown
|
||||
// if (popupInterlockIsShown)
|
||||
// TriList.SetBool(NextCaretVisible, true);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Whenever a popup is shown/hidden, show/hide the header carets subpage and set the visibility of the correct caret
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void PopupInterlock_StatusChanged(object sender, StatusChangedEventArgs e)
|
||||
{
|
||||
// Set the visible state for the HeaderPopupCaretsSubpage to match that of the PopupInterlock state
|
||||
|
||||
bool headerPopupShown = false;
|
||||
|
||||
// Check if the popup interlock is shown, and if one of the header popups is current, then show the carets subpage
|
||||
if (e.IsShown)
|
||||
{
|
||||
if (e.NewJoin == Parent.EnvironmentDriver.BackgroundSubpageJoin)
|
||||
headerPopupShown = true;
|
||||
else if (e.NewJoin == UIBoolJoin.HeaderActiveCallsListVisible)
|
||||
headerPopupShown = true;
|
||||
else if (e.NewJoin == UIBoolJoin.HelpPageVisible)
|
||||
headerPopupShown = true;
|
||||
else if (e.NewJoin == UIBoolJoin.MeetingsOrContacMethodsListVisible)
|
||||
headerPopupShown = true;
|
||||
else if (e.NewJoin == UIBoolJoin.VolumesPagePowerOffVisible || e.NewJoin == UIBoolJoin.VolumesPageVisible)
|
||||
headerPopupShown = true;
|
||||
}
|
||||
|
||||
// Set the carets subpage visibility
|
||||
TriList.SetBool(UIBoolJoin.HeaderPopupCaretsSubpageVisibile, headerPopupShown);
|
||||
|
||||
if (!e.IsShown)
|
||||
CaretInterlock.HideAndClear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class JoinedSigInterlock
|
||||
{
|
||||
public uint CurrentJoin { get; private set; }
|
||||
|
||||
BasicTriList TriList;
|
||||
|
||||
public BoolFeedback IsShownFeedback;
|
||||
|
||||
bool _IsShown;
|
||||
|
||||
public bool IsShown
|
||||
{
|
||||
get
|
||||
{
|
||||
return _IsShown;
|
||||
}
|
||||
private set
|
||||
{
|
||||
_IsShown = value;
|
||||
IsShownFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//public BoolFeedback ShownFeedback { get; private set; }
|
||||
|
||||
public JoinedSigInterlock(BasicTriList triList)
|
||||
{
|
||||
TriList = triList;
|
||||
|
||||
IsShownFeedback = new BoolFeedback(new Func<bool>( () => _IsShown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides CurrentJoin and shows join. Will check and re-set signal if join
|
||||
/// equals CurrentJoin
|
||||
/// </summary>
|
||||
public void ShowInterlocked(uint join)
|
||||
{
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
|
||||
if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue)
|
||||
return;
|
||||
SetButDontShow(join);
|
||||
TriList.SetBool(CurrentJoin, true);
|
||||
IsShown = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="join"></param>
|
||||
public void ShowInterlockedWithToggle(uint join)
|
||||
{
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
|
||||
if (CurrentJoin == join)
|
||||
HideAndClear();
|
||||
else
|
||||
{
|
||||
if (CurrentJoin > 0)
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = false;
|
||||
CurrentJoin = join;
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = true;
|
||||
IsShown = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Hides current join and clears CurrentJoin
|
||||
/// </summary>
|
||||
public void HideAndClear()
|
||||
{
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
|
||||
Hide();
|
||||
CurrentJoin = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides the current join but does not clear the selected join in case
|
||||
/// it needs to be reshown
|
||||
/// </summary>
|
||||
public void Hide()
|
||||
{
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
|
||||
if (CurrentJoin > 0)
|
||||
{
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = false;
|
||||
IsShown = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If CurrentJoin is set, it restores that join
|
||||
/// </summary>
|
||||
public void Show()
|
||||
{
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin);
|
||||
if (CurrentJoin > 0)
|
||||
{
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = true;
|
||||
IsShown = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Useful for pre-setting the interlock but not enabling it. Sets CurrentJoin
|
||||
/// </summary>
|
||||
/// <param name="join"></param>
|
||||
public void SetButDontShow(uint join)
|
||||
{
|
||||
if (CurrentJoin > 0)
|
||||
{
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = false;
|
||||
IsShown = false;
|
||||
}
|
||||
CurrentJoin = join;
|
||||
}
|
||||
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class JoinedSigInterlock
|
||||
{
|
||||
public uint CurrentJoin { get; private set; }
|
||||
|
||||
BasicTriList TriList;
|
||||
|
||||
public BoolFeedback IsShownFeedback;
|
||||
|
||||
public event EventHandler<StatusChangedEventArgs> StatusChanged;
|
||||
|
||||
bool _IsShown;
|
||||
|
||||
public bool IsShown
|
||||
{
|
||||
get
|
||||
{
|
||||
return _IsShown;
|
||||
}
|
||||
private set
|
||||
{
|
||||
_IsShown = value;
|
||||
IsShownFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//public BoolFeedback ShownFeedback { get; private set; }
|
||||
|
||||
public JoinedSigInterlock(BasicTriList triList)
|
||||
{
|
||||
TriList = triList;
|
||||
|
||||
IsShownFeedback = new BoolFeedback(new Func<bool>( () => _IsShown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides CurrentJoin and shows join. Will check and re-set signal if join
|
||||
/// equals CurrentJoin
|
||||
/// </summary>
|
||||
public void ShowInterlocked(uint join)
|
||||
{
|
||||
var prevJoin = CurrentJoin;
|
||||
var wasShown = _IsShown;
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
|
||||
if (CurrentJoin == join && TriList.BooleanInput[join].BoolValue)
|
||||
return;
|
||||
SetButDontShow(join);
|
||||
TriList.SetBool(CurrentJoin, true);
|
||||
IsShown = true;
|
||||
|
||||
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="join"></param>
|
||||
public void ShowInterlockedWithToggle(uint join)
|
||||
{
|
||||
var prevJoin = CurrentJoin;
|
||||
var wasShown = IsShown;
|
||||
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock swapping {1} for {2}", TriList.ID, CurrentJoin, join);
|
||||
if (CurrentJoin == join)
|
||||
HideAndClear();
|
||||
else
|
||||
{
|
||||
if (CurrentJoin > 0)
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = false;
|
||||
CurrentJoin = join;
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = true;
|
||||
IsShown = true;
|
||||
|
||||
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Hides current join and clears CurrentJoin
|
||||
/// </summary>
|
||||
public void HideAndClear()
|
||||
{
|
||||
var prevJoin = CurrentJoin;
|
||||
var wasShown = IsShown;
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
|
||||
Hide();
|
||||
CurrentJoin = 0;
|
||||
|
||||
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides the current join but does not clear the selected join in case
|
||||
/// it needs to be reshown
|
||||
/// </summary>
|
||||
public void Hide()
|
||||
{
|
||||
var prevJoin = CurrentJoin;
|
||||
var wasShown = IsShown;
|
||||
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock hiding {1}", TriList.ID, CurrentJoin);
|
||||
if (CurrentJoin > 0)
|
||||
{
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = false;
|
||||
IsShown = false;
|
||||
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If CurrentJoin is set, it restores that join
|
||||
/// </summary>
|
||||
public void Show()
|
||||
{
|
||||
var prevJoin = CurrentJoin;
|
||||
var wasShown = IsShown;
|
||||
|
||||
Debug.Console(2, "Trilist {0:X2}, interlock showing {1}", TriList.ID, CurrentJoin);
|
||||
if (CurrentJoin > 0)
|
||||
{
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = true;
|
||||
IsShown = true;
|
||||
|
||||
OnStatusChange(prevJoin, CurrentJoin, wasShown, IsShown);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Useful for pre-setting the interlock but not enabling it. Sets CurrentJoin
|
||||
/// </summary>
|
||||
/// <param name="join"></param>
|
||||
public void SetButDontShow(uint join)
|
||||
{
|
||||
if (CurrentJoin > 0)
|
||||
{
|
||||
TriList.BooleanInput[CurrentJoin].BoolValue = false;
|
||||
IsShown = false;
|
||||
}
|
||||
CurrentJoin = join;
|
||||
}
|
||||
|
||||
void OnStatusChange(uint prevJoin, uint newJoin, bool wasShown, bool isShown)
|
||||
{
|
||||
var handler = StatusChanged;
|
||||
if (handler != null)
|
||||
handler(this, new StatusChangedEventArgs(prevJoin, newJoin, wasShown, isShown));
|
||||
}
|
||||
}
|
||||
|
||||
public class StatusChangedEventArgs : EventArgs
|
||||
{
|
||||
public uint PreviousJoin { get; set; }
|
||||
public uint NewJoin { get; set; }
|
||||
public bool WasShown { get; set; }
|
||||
public bool IsShown { get; set; }
|
||||
|
||||
public StatusChangedEventArgs(uint prevJoin, uint newJoin, bool wasShown, bool isShown)
|
||||
{
|
||||
PreviousJoin = prevJoin;
|
||||
NewJoin = newJoin;
|
||||
WasShown = wasShown;
|
||||
IsShown = isShown;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user