mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-10 02:05:08 +00:00
cleaned out framework files; added framework submodule; referneced p.core to reference in framework; moved essentials.sln; changed paths in sln to match; test build
This commit is contained in:
231
PepperDashEssentials/UIDrivers/DualDisplayRouting.cs
Normal file
231
PepperDashEssentials/UIDrivers/DualDisplayRouting.cs
Normal file
@@ -0,0 +1,231 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
//using PepperDash.Core;
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Core.SmartObjects;
|
||||
//using PepperDash.Essentials.Core.PageManagers;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class DualDisplaySimpleOrAdvancedRouting : PanelDriverBase
|
||||
// {
|
||||
// EssentialsPresentationPanelAvFunctionsDriver Parent;
|
||||
|
||||
// /// <summary>
|
||||
// /// Smart Object 3200
|
||||
// /// </summary>
|
||||
// SubpageReferenceList SourcesSrl;
|
||||
|
||||
// /// <summary>
|
||||
// /// For tracking feedback on last selected
|
||||
// /// </summary>
|
||||
// BoolInputSig LastSelectedSourceSig;
|
||||
|
||||
// /// <summary>
|
||||
// /// The source that has been selected and is awaiting assignment to a display
|
||||
// /// </summary>
|
||||
// SourceListItem PendingSource;
|
||||
|
||||
// bool IsSharingModeAdvanced;
|
||||
|
||||
// public DualDisplaySimpleOrAdvancedRouting(EssentialsPresentationPanelAvFunctionsDriver parent) : base(parent.TriList)
|
||||
// {
|
||||
// Parent = parent;
|
||||
// SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
|
||||
|
||||
// TriList.SetSigFalseAction(UIBoolJoin.ToggleSharingModePress, ToggleSharingModePressed);
|
||||
|
||||
// TriList.SetSigFalseAction(UIBoolJoin.Display1AudioButtonPressAndFb, Display1AudioPress);
|
||||
// TriList.SetSigFalseAction(UIBoolJoin.Display1ControlButtonPress, Display1ControlPress);
|
||||
// TriList.SetSigTrueAction(UIBoolJoin.Display1SelectPressAndFb, Display1Press);
|
||||
|
||||
// TriList.SetSigFalseAction(UIBoolJoin.Display2AudioButtonPressAndFb, Display2AudioPress);
|
||||
// TriList.SetSigFalseAction(UIBoolJoin.Display2ControlButtonPress, Display2ControlPress);
|
||||
// TriList.SetSigTrueAction(UIBoolJoin.Display2SelectPressAndFb, Display2Press);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public override void Show()
|
||||
// {
|
||||
// TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible].BoolValue = true;
|
||||
// TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = true;
|
||||
// if(IsSharingModeAdvanced)
|
||||
// TriList.BooleanInput[UIBoolJoin.DualDisplayPageVisible].BoolValue = true;
|
||||
// else
|
||||
// TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true;
|
||||
// base.Show();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// //public override void Hide()
|
||||
// //{
|
||||
// // TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible].BoolValue = false;
|
||||
// // TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = false;
|
||||
// // if(IsSharingModeAdvanced)
|
||||
// // TriList.BooleanInput[UIBoolJoin.DualDisplayPageVisible].BoolValue = false;
|
||||
// // else
|
||||
// // TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
|
||||
// // base.Hide();
|
||||
// //}
|
||||
|
||||
// public void SetCurrentRoomFromParent()
|
||||
// {
|
||||
// if (IsSharingModeAdvanced)
|
||||
// return; // add stuff here
|
||||
// else
|
||||
// SetupSourceListForSimpleRouting();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// void SetupSourceListForSimpleRouting()
|
||||
// {
|
||||
// // get the source list config and set up the source list
|
||||
// var config = ConfigReader.ConfigObject.SourceLists;
|
||||
// if (config.ContainsKey(Parent.CurrentRoom.SourceListKey))
|
||||
// {
|
||||
// var srcList = config[Parent.CurrentRoom.SourceListKey]
|
||||
// .Values.ToList().OrderBy(s => s.Order);
|
||||
// // Setup sources list
|
||||
// uint i = 1; // counter for UI list
|
||||
// foreach (var srcConfig in srcList)
|
||||
// {
|
||||
// if (!srcConfig.IncludeInSourceList) // Skip sources marked this way
|
||||
// continue;
|
||||
|
||||
// var sourceKey = srcConfig.SourceKey;
|
||||
// var actualSource = DeviceManager.GetDeviceForKey(sourceKey) as Device;
|
||||
// if (actualSource == null)
|
||||
// {
|
||||
// Debug.Console(0, "Cannot assign missing source '{0}' to source UI list",
|
||||
// srcConfig.SourceKey);
|
||||
// continue;
|
||||
// }
|
||||
// var localSrcItem = srcConfig; // lambda scope below
|
||||
// var localIndex = i;
|
||||
// SourcesSrl.GetBoolFeedbackSig(i, 1).UserObject = new Action<bool>(b =>
|
||||
// {
|
||||
// if (IsSharingModeAdvanced)
|
||||
// {
|
||||
// if (LastSelectedSourceSig != null)
|
||||
// LastSelectedSourceSig.BoolValue = false;
|
||||
// SourceListButtonPress(localSrcItem);
|
||||
// LastSelectedSourceSig = SourcesSrl.BoolInputSig(localIndex, 1);
|
||||
// LastSelectedSourceSig.BoolValue = true;
|
||||
// }
|
||||
// else
|
||||
// Parent.CurrentRoom.DoSourceToAllDestinationsRoute(localSrcItem);
|
||||
// });
|
||||
// SourcesSrl.StringInputSig(i, 1).StringValue = srcConfig.PreferredName;
|
||||
// i++;
|
||||
|
||||
// //var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig,
|
||||
// // b => { if (!b) UiSelectSource(localSrcConfig); });
|
||||
// //SourcesSrl.AddItem(item); // add to the SRL
|
||||
// //item.RegisterForSourceChange(Parent.CurrentRoom);
|
||||
// }
|
||||
// SourcesSrl.Count = (ushort)(i - 1);
|
||||
// Parent.CurrentRoom.CurrentSingleSourceChange += CurrentRoom_CurrentSourceInfoChange;
|
||||
// Parent.CurrentRoom.CurrentDisplay1SourceChange += CurrentRoom_CurrentDisplay1SourceChange;
|
||||
// Parent.CurrentRoom.CurrentDisplay2SourceChange += CurrentRoom_CurrentDisplay2SourceChange;
|
||||
// }
|
||||
// }
|
||||
|
||||
// void SetupSourceListForAdvancedRouting()
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// void CurrentRoom_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// void CurrentRoom_CurrentDisplay1SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
// TriList.StringInput[UIStringJoin.Display1SourceLabel].StringValue = PendingSource.PreferredName;
|
||||
|
||||
// }
|
||||
|
||||
// void CurrentRoom_CurrentDisplay2SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
// {
|
||||
// TriList.StringInput[UIStringJoin.Display2SourceLabel].StringValue = PendingSource.PreferredName;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// void ToggleSharingModePressed()
|
||||
// {
|
||||
// Hide();
|
||||
// IsSharingModeAdvanced = !IsSharingModeAdvanced;
|
||||
// TriList.BooleanInput[UIBoolJoin.ToggleSharingModePress].BoolValue = IsSharingModeAdvanced;
|
||||
// Show();
|
||||
// }
|
||||
|
||||
// public void SourceListButtonPress(SourceListItem item)
|
||||
// {
|
||||
// // start the timer
|
||||
// // show FB on potential source
|
||||
// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = false;
|
||||
// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = false;
|
||||
// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = false;
|
||||
// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = false;
|
||||
// PendingSource = item;
|
||||
// }
|
||||
|
||||
// void EnableAppropriateDisplayButtons()
|
||||
// {
|
||||
// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = true;
|
||||
// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = true;
|
||||
// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = true;
|
||||
// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = true;
|
||||
// if (LastSelectedSourceSig != null)
|
||||
// LastSelectedSourceSig.BoolValue = false;
|
||||
// }
|
||||
|
||||
// public void Display1Press()
|
||||
// {
|
||||
// EnableAppropriateDisplayButtons();
|
||||
// Parent.CurrentRoom.SourceToDisplay1(PendingSource);
|
||||
// // Enable end meeting
|
||||
// }
|
||||
|
||||
// public void Display1AudioPress()
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// public void Display1ControlPress()
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// public void Display2Press()
|
||||
// {
|
||||
// EnableAppropriateDisplayButtons();
|
||||
// Parent.CurrentRoom.SourceToDisplay2(PendingSource);
|
||||
// }
|
||||
|
||||
// public void Display2AudioPress()
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// public void Display2ControlPress()
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,251 @@
|
||||
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; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
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.Lighting;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// Supports a lighting device with up to 6 scenes
|
||||
/// </summary>
|
||||
public class EssentialsLightingDriver : PanelDriverBase, IEnvironmentSubdriver
|
||||
{
|
||||
EssentialsEnvironmentDriver Parent;
|
||||
|
||||
public LightingBase LightingDevice { get; private set; }
|
||||
|
||||
public uint SubpageVisibleJoin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The base join number that all button visibilty joins are offset from
|
||||
/// </summary>
|
||||
uint ButtonVisibleJoinBase;
|
||||
|
||||
/// <summary>
|
||||
/// The base join number that all button presses are offset from
|
||||
/// </summary>
|
||||
uint ButtonPressJoinBase;
|
||||
|
||||
/// <summary>
|
||||
/// The base join number that all string lables are offset from
|
||||
/// </summary>
|
||||
uint StringJoinBase;
|
||||
|
||||
eLightsDeviceType DeviceType;
|
||||
|
||||
const uint DeviceNameJoinOffset = 50;
|
||||
|
||||
public EssentialsLightingDriver(EssentialsEnvironmentDriver parent, string deviceKey, uint buttonPressJoinBase, uint buttonVisibleJoinBase, uint stringJoinBase, uint subpageVisibleBase)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
ButtonPressJoinBase = buttonPressJoinBase;
|
||||
ButtonVisibleJoinBase = buttonVisibleJoinBase;
|
||||
StringJoinBase = stringJoinBase;
|
||||
|
||||
LightingDevice = DeviceManager.GetDeviceForKey(deviceKey) as LightingBase;
|
||||
|
||||
//LightingDevice.LightingSceneChange += new EventHandler<LightingSceneChangeEventArgs>(LightingDevice_LightingSceneChange);
|
||||
|
||||
SetDeviceType();
|
||||
|
||||
SetSubpageVisibleJoin(subpageVisibleBase);
|
||||
|
||||
SetUpDeviceName();
|
||||
|
||||
SetUpButtonActions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles setting feedback for the currently selected scene button
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void LightingDevice_LightingSceneChange(object sender, LightingSceneChangeEventArgs e)
|
||||
{
|
||||
uint joinOffset = 1;
|
||||
|
||||
foreach (var scene in LightingDevice.LightingScenes)
|
||||
{
|
||||
if (scene == e.CurrentLightingScene)
|
||||
TriList.SetBool(ButtonPressJoinBase + joinOffset, true);
|
||||
else
|
||||
TriList.SetBool(ButtonPressJoinBase + joinOffset, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
TriList.SetBool(SubpageVisibleJoin, true);
|
||||
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
TriList.SetBool(SubpageVisibleJoin, false);
|
||||
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
void SetUpDeviceName()
|
||||
{
|
||||
Parent.TriList.SetString(StringJoinBase + DeviceNameJoinOffset, LightingDevice.Name);
|
||||
}
|
||||
|
||||
void SetDeviceType()
|
||||
{
|
||||
if (LightingDevice is ILightingScenes)
|
||||
DeviceType = eLightsDeviceType.Scenes;
|
||||
}
|
||||
|
||||
void SetSubpageVisibleJoin(uint subpageVisibleBase)
|
||||
{
|
||||
SubpageVisibleJoin = subpageVisibleBase + (uint)DeviceType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drase
|
||||
/// </summary>
|
||||
void SetUpButtonActions()
|
||||
{
|
||||
if (DeviceType == eLightsDeviceType.Scenes)
|
||||
{
|
||||
uint joinOffset = ComputeJoinOffset();
|
||||
|
||||
// Clear preceding buttons
|
||||
for (uint i = 1; i < joinOffset; i++)
|
||||
{
|
||||
TriList.SetString(StringJoinBase + i, "");
|
||||
TriList.SetSigFalseAction(ButtonPressJoinBase + i, () => { });
|
||||
TriList.SetBool(ButtonVisibleJoinBase + i, false);
|
||||
}
|
||||
|
||||
foreach (var scene in LightingDevice.LightingScenes)
|
||||
{
|
||||
TriList.SetString(StringJoinBase + joinOffset, scene.Name);
|
||||
var tempScene = scene;
|
||||
TriList.SetSigFalseAction(ButtonPressJoinBase + joinOffset, () => LightingDevice.SelectScene(tempScene));
|
||||
scene.IsActiveFeedback.LinkInputSig(TriList.BooleanInput[ButtonPressJoinBase + joinOffset]);
|
||||
TriList.SetBool(ButtonVisibleJoinBase + joinOffset, true);
|
||||
|
||||
joinOffset++;
|
||||
}
|
||||
|
||||
// Clear following buttons
|
||||
for (uint i = joinOffset; i <= 6; i++)
|
||||
{
|
||||
TriList.SetString(StringJoinBase + i, "");
|
||||
TriList.SetSigFalseAction(ButtonPressJoinBase + i, () => { });
|
||||
TriList.SetBool(ButtonVisibleJoinBase + i, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Computes the desired join offset to try to achieve the most centered appearance when using a subpage with 6 scene buttons
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
uint ComputeJoinOffset()
|
||||
{
|
||||
uint joinOffset = 0;
|
||||
|
||||
switch (LightingDevice.LightingScenes.Count)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
joinOffset = 2;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
joinOffset = 3;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
joinOffset = 2;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
joinOffset = 2;
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
joinOffset = 2;
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
joinOffset = 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return joinOffset;
|
||||
}
|
||||
}
|
||||
|
||||
enum eLightsDeviceType : uint
|
||||
{
|
||||
None = 0,
|
||||
Scenes = 1,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
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.Devices.Common.Environment.Somfy;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class EssentialsShadeDriver : PanelDriverBase, IEnvironmentSubdriver
|
||||
{
|
||||
EssentialsEnvironmentDriver Parent;
|
||||
|
||||
public ShadeBase ShadeDevice { get; private set; }
|
||||
|
||||
public uint SubpageVisibleJoin { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The base join number that all button presses are offset from
|
||||
/// </summary>
|
||||
uint ButtonPressJoinBase;
|
||||
|
||||
/// <summary>
|
||||
/// The base join number that all string lables are offset from
|
||||
/// </summary>
|
||||
uint StringJoinBase;
|
||||
|
||||
eShadeDeviceType DeviceType;
|
||||
|
||||
const uint DeviceNameJoinOffset = 50;
|
||||
|
||||
public EssentialsShadeDriver(EssentialsEnvironmentDriver parent, string deviceKey, uint buttonPressJoinBase, uint stringJoinBase, uint subpageVisibleBase)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
ButtonPressJoinBase = buttonPressJoinBase;
|
||||
StringJoinBase = stringJoinBase;
|
||||
|
||||
ShadeDevice = DeviceManager.GetDeviceForKey(deviceKey) as ShadeBase;
|
||||
|
||||
SetDeviceType();
|
||||
|
||||
SetSubpageVisibleJoin(subpageVisibleBase);
|
||||
|
||||
SetUpDeviceName();
|
||||
|
||||
SetUpButtonActions();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
TriList.SetBool(SubpageVisibleJoin, true);
|
||||
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
TriList.SetBool(SubpageVisibleJoin, false);
|
||||
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
void SetUpDeviceName()
|
||||
{
|
||||
Parent.TriList.SetString(StringJoinBase + DeviceNameJoinOffset, ShadeDevice.Name);
|
||||
}
|
||||
|
||||
void SetDeviceType()
|
||||
{
|
||||
if (ShadeDevice is IShadesOpenCloseStop)
|
||||
DeviceType = eShadeDeviceType.OpenCloseStop;
|
||||
else if (ShadeDevice is IShadesOpenClose)
|
||||
DeviceType = eShadeDeviceType.OpenClose;
|
||||
}
|
||||
|
||||
void SetSubpageVisibleJoin(uint subpageVisibleBase)
|
||||
{
|
||||
SubpageVisibleJoin = subpageVisibleBase + (uint)DeviceType;
|
||||
}
|
||||
|
||||
void SetUpButtonActions()
|
||||
{
|
||||
if(DeviceType == eShadeDeviceType.OpenClose)
|
||||
{
|
||||
TriList.SetSigTrueAction(ButtonPressJoinBase + 1, ShadeDevice.Open);
|
||||
|
||||
TriList.SetSigFalseAction(ButtonPressJoinBase + 2, ShadeDevice.Close);
|
||||
}
|
||||
else if(DeviceType == eShadeDeviceType.OpenCloseStop)
|
||||
{
|
||||
TriList.SetSigFalseAction(ButtonPressJoinBase + 1, ShadeDevice.Open);
|
||||
|
||||
TriList.SetSigFalseAction(ButtonPressJoinBase + 2, (ShadeDevice as IShadesOpenCloseStop).StopOrPreset);
|
||||
|
||||
if(ShadeDevice is RelayControlledShade)
|
||||
TriList.SetString(StringJoinBase + 2, (ShadeDevice as RelayControlledShade).StopOrPresetButtonLabel);
|
||||
|
||||
TriList.SetSigFalseAction(ButtonPressJoinBase + 3, ShadeDevice.Close);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum eShadeDeviceType : uint
|
||||
{
|
||||
None = 0,
|
||||
OpenCloseStop = 1,
|
||||
OpenClose = 2,
|
||||
DiscreteLevel = 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsPanelMainInterfaceDriver : PanelDriverBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Assign the appropriate A/V driver.
|
||||
/// Want to keep the AvDriver alive, because it may hold states
|
||||
/// </summary>
|
||||
public IAVDriver AvDriver { get; set; }
|
||||
|
||||
public EssentialsHeaderDriver HeaderDriver { get; set; }
|
||||
|
||||
public EssentialsEnvironmentDriver EnvironmentDriver { get; set; }
|
||||
|
||||
public PanelDriverBase CurrentChildDriver { get; private set; }
|
||||
|
||||
CrestronTouchpanelPropertiesConfig Config;
|
||||
|
||||
/// <summary>
|
||||
/// The main interlock for popups
|
||||
/// </summary>
|
||||
//public JoinedSigInterlock PopupInterlock { get; private set; }
|
||||
|
||||
public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist,
|
||||
CrestronTouchpanelPropertiesConfig config)
|
||||
: base(trilist)
|
||||
{
|
||||
Config = config;
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
CurrentChildDriver = null;
|
||||
ShowSubDriver(AvDriver as PanelDriverBase);
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
TriList.BooleanInput[UIBoolJoin.StartPageVisible].BoolValue = false;
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
void ShowSubDriver(PanelDriverBase driver)
|
||||
{
|
||||
CurrentChildDriver = driver;
|
||||
if (driver == null)
|
||||
return;
|
||||
this.Hide();
|
||||
driver.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void BackButtonPressed()
|
||||
{
|
||||
if(CurrentChildDriver != null)
|
||||
CurrentChildDriver.BackButtonPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,325 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Core.Touchpanels.Keyboards;
|
||||
using PepperDash.Essentials.Devices.Displays;
|
||||
using PepperDash.Essentials.Room.Config;
|
||||
|
||||
namespace PepperDash.Essentials.UIDrivers
|
||||
{
|
||||
public class EssentialsHuddleTechPageDriver : PanelDriverBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
SmartObjectDynamicList MenuList;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
SubpageReferenceList StatusList;
|
||||
/// <summary>
|
||||
/// The list of display controls
|
||||
/// </summary>
|
||||
SubpageReferenceList DisplayList;
|
||||
/// <summary>
|
||||
/// References lines in the list against device instances
|
||||
/// </summary>
|
||||
Dictionary<ICommunicationMonitor, uint> StatusListDeviceIndexes;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
JoinedSigInterlock PagesInterlock;
|
||||
|
||||
/// <summary>
|
||||
/// 1
|
||||
/// </summary>
|
||||
public const uint JoinText = 1;
|
||||
|
||||
CTimer PinAuthorizedTimer;
|
||||
|
||||
EssentialsRoomTechConfig Config;
|
||||
|
||||
StringBuilder PinEntryBuilder = new StringBuilder(4);
|
||||
|
||||
bool IsAuthorized;
|
||||
|
||||
SmartObjectNumeric PinKeypad;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="trilist"></param>
|
||||
/// <param name="parent"></param>
|
||||
public EssentialsHuddleTechPageDriver(BasicTriListWithSmartObject trilist, EssentialsRoomTechConfig config)
|
||||
: base(trilist)
|
||||
{
|
||||
Config = config;
|
||||
|
||||
PagesInterlock = new JoinedSigInterlock(trilist);
|
||||
PagesInterlock.SetButDontShow(UIBoolJoin.TechSystemStatusVisible);
|
||||
|
||||
trilist.SetSigFalseAction(UIBoolJoin.TechExitButton, Hide);
|
||||
|
||||
MenuList = new SmartObjectDynamicList(trilist.SmartObjects[UISmartObjectJoin.TechMenuList],
|
||||
true, 3100);
|
||||
|
||||
MenuList.SetFeedback(1, true); // initial fb
|
||||
ushort count = 0;
|
||||
|
||||
MenuList.SetItemMainText(1, "System Status");
|
||||
MenuList.SetItemButtonAction(1, b => {
|
||||
if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechSystemStatusVisible);
|
||||
MenuList.SetFeedback(1, true);
|
||||
});
|
||||
|
||||
MenuList.SetItemMainText(2, "Display Controls");
|
||||
MenuList.SetItemButtonAction(2, b => {
|
||||
if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechDisplayControlsVisible);
|
||||
MenuList.SetFeedback(2, true);
|
||||
});
|
||||
|
||||
count = 2;
|
||||
|
||||
// Don't show panel setup on iPad or xpanel
|
||||
if (TriList is Crestron.SimplSharpPro.DeviceSupport.TswFt5Button)
|
||||
{
|
||||
count++;
|
||||
MenuList.SetItemMainText(count, "Panel Setup");
|
||||
MenuList.SetItemButtonAction(count, b =>
|
||||
{
|
||||
if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechPanelSetupVisible);
|
||||
MenuList.SetFeedback(count, true);
|
||||
});
|
||||
}
|
||||
|
||||
MenuList.Count = count;
|
||||
BuildStatusList();
|
||||
BuildDisplayList();
|
||||
SetupPinModal();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void Show()
|
||||
{
|
||||
// divert to PIN if we need auth
|
||||
if (IsAuthorized)
|
||||
{
|
||||
// Cancel the auth timer so we don't deauth after coming back in
|
||||
if (PinAuthorizedTimer != null)
|
||||
PinAuthorizedTimer.Stop();
|
||||
|
||||
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, true);
|
||||
PagesInterlock.Show();
|
||||
base.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void Hide()
|
||||
{
|
||||
// Leave it authorized for 60 seconds.
|
||||
if (IsAuthorized)
|
||||
PinAuthorizedTimer = new CTimer(o => {
|
||||
IsAuthorized = false;
|
||||
PinAuthorizedTimer = null;
|
||||
}, 60000);
|
||||
TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, false);
|
||||
PagesInterlock.Hide();
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wire up the keypad and buttons
|
||||
/// </summary>
|
||||
void SetupPinModal()
|
||||
{
|
||||
TriList.SetSigFalseAction(UIBoolJoin.PinDialogCancelPress, CancelPinDialog);
|
||||
PinKeypad = new SmartObjectNumeric(TriList.SmartObjects[UISmartObjectJoin.TechPinDialogKeypad], true);
|
||||
PinKeypad.Digit0.UserObject = new Action<bool>(b => { if (b)DialPinDigit('0'); });
|
||||
PinKeypad.Digit1.UserObject = new Action<bool>(b => { if (b)DialPinDigit('1'); });
|
||||
PinKeypad.Digit2.UserObject = new Action<bool>(b => { if (b)DialPinDigit('2'); });
|
||||
PinKeypad.Digit3.UserObject = new Action<bool>(b => { if (b)DialPinDigit('3'); });
|
||||
PinKeypad.Digit4.UserObject = new Action<bool>(b => { if (b)DialPinDigit('4'); });
|
||||
PinKeypad.Digit5.UserObject = new Action<bool>(b => { if (b)DialPinDigit('5'); });
|
||||
PinKeypad.Digit6.UserObject = new Action<bool>(b => { if (b)DialPinDigit('6'); });
|
||||
PinKeypad.Digit7.UserObject = new Action<bool>(b => { if (b)DialPinDigit('7'); });
|
||||
PinKeypad.Digit8.UserObject = new Action<bool>(b => { if (b)DialPinDigit('8'); });
|
||||
PinKeypad.Digit9.UserObject = new Action<bool>(b => { if (b)DialPinDigit('9'); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="d"></param>
|
||||
void DialPinDigit(char d)
|
||||
{
|
||||
PinEntryBuilder.Append(d);
|
||||
var len = PinEntryBuilder.Length;
|
||||
SetPinDotsFeedback(len);
|
||||
|
||||
// check it!
|
||||
if (len == 4)
|
||||
{
|
||||
if (Config.Password == PinEntryBuilder.ToString())
|
||||
{
|
||||
IsAuthorized = true;
|
||||
SetPinDotsFeedback(0);
|
||||
TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, false);
|
||||
Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPinDotsFeedback(0);
|
||||
TriList.SetBool(UIBoolJoin.PinDialogErrorVisible, true);
|
||||
new CTimer(o =>
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.PinDialogErrorVisible, false);
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
PinEntryBuilder.Remove(0, len); // clear it either way
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the dots as pin is entered
|
||||
/// </summary>
|
||||
/// <param name="len"></param>
|
||||
void SetPinDotsFeedback(int len)
|
||||
{
|
||||
TriList.SetBool(UIBoolJoin.PinDialogDot1, len >= 1);
|
||||
TriList.SetBool(UIBoolJoin.PinDialogDot2, len >= 2);
|
||||
TriList.SetBool(UIBoolJoin.PinDialogDot3, len >= 3);
|
||||
TriList.SetBool(UIBoolJoin.PinDialogDot4, len == 4);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does what it says
|
||||
/// </summary>
|
||||
void CancelPinDialog()
|
||||
{
|
||||
PinEntryBuilder.Remove(0, PinEntryBuilder.Length);
|
||||
TriList.SetBool(UIBoolJoin.PinDialog4DigitVisible, false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void BuildStatusList()
|
||||
{
|
||||
StatusList = new SubpageReferenceList(TriList, UISmartObjectJoin.TechStatusList, 3, 3, 3);
|
||||
StatusListDeviceIndexes = new Dictionary<ICommunicationMonitor, uint>();
|
||||
uint i = 0;
|
||||
foreach (var d in DeviceManager.AllDevices)
|
||||
{
|
||||
// make sure it is both ICommunicationMonitor and a Device
|
||||
var sd = d as ICommunicationMonitor;
|
||||
if (sd == null)
|
||||
continue;
|
||||
var dd = sd as Device;
|
||||
if(dd == null)
|
||||
continue;
|
||||
i++;
|
||||
StatusList.StringInputSig(i, 1).StringValue = dd.Name;
|
||||
StatusList.UShortInputSig(i, 1).UShortValue = (ushort)sd.CommunicationMonitor.Status;
|
||||
StatusListDeviceIndexes.Add(sd, i);
|
||||
sd.CommunicationMonitor.StatusChange += CommunicationMonitor_StatusChange ;
|
||||
}
|
||||
StatusList.Count = (ushort)i;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the list of display controls
|
||||
/// </summary>
|
||||
void BuildDisplayList()
|
||||
{
|
||||
DisplayList = new SubpageReferenceList(TriList, UISmartObjectJoin.TechDisplayControlsList, 10, 3, 3);
|
||||
|
||||
var devKeys = ConfigReader.ConfigObject.Devices.Where(d =>
|
||||
d.Group.Equals("display", StringComparison.OrdinalIgnoreCase)
|
||||
|| d.Group.Equals("projector", StringComparison.OrdinalIgnoreCase))
|
||||
.Select(dd => dd.Key);
|
||||
var disps = DeviceManager.AllDevices.Where(d =>
|
||||
devKeys.Contains(d.Key));
|
||||
ushort i = 0;
|
||||
foreach (var disp in disps)
|
||||
{
|
||||
var display = disp as DisplayBase;
|
||||
if (display != null)
|
||||
{
|
||||
i++;
|
||||
DisplayList.StringInputSig(i, 1).StringValue = display.Name;
|
||||
DisplayList.GetBoolFeedbackSig(i, 1).SetSigFalseAction(display.PowerOn);
|
||||
DisplayList.GetBoolFeedbackSig(i, 2).SetSigFalseAction(display.PowerOff);
|
||||
if (display is TwoWayDisplayBase)
|
||||
{
|
||||
var powerOnSig = DisplayList.BoolInputSig(i, 1);
|
||||
(display as TwoWayDisplayBase).PowerIsOnFeedback.LinkInputSig(powerOnSig);
|
||||
|
||||
var powerOffSig = DisplayList.BoolInputSig(1, 2);
|
||||
(display as TwoWayDisplayBase).PowerIsOnFeedback.LinkComplementInputSig(powerOffSig);
|
||||
}
|
||||
DisplayList.GetBoolFeedbackSig(i, 3).SetSigFalseAction(() =>
|
||||
{ if (display is IInputHdmi1) (display as IInputHdmi1).InputHdmi1(); });
|
||||
DisplayList.GetBoolFeedbackSig(i, 4).SetSigFalseAction(() =>
|
||||
{ if (display is IInputHdmi2) (display as IInputHdmi2).InputHdmi2(); });
|
||||
DisplayList.GetBoolFeedbackSig(i, 5).SetSigFalseAction(() =>
|
||||
{ if (display is IInputHdmi3) (display as IInputHdmi3).InputHdmi3(); });
|
||||
//DisplayList.GetBoolFeedbackSig(i, 6).SetSigFalseAction(() =>
|
||||
//{ if (display is IInputHdmi4) (display as IInputHdmi4).InputHdmi4(); });
|
||||
DisplayList.GetBoolFeedbackSig(i, 6).SetSigFalseAction(() =>
|
||||
{ if (display is IInputDisplayPort1) (display as IInputDisplayPort1).InputDisplayPort1(); });
|
||||
|
||||
|
||||
// Figure out some way to provide current input feedback
|
||||
if (display is TwoWayDisplayBase)
|
||||
{
|
||||
(display as TwoWayDisplayBase).CurrentInputFeedback.OutputChange += CurrentInputFeedback_OutputChange;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
DisplayList.Count = i;
|
||||
}
|
||||
|
||||
|
||||
void CurrentInputFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void CommunicationMonitor_StatusChange(object sender, MonitorStatusChangeEventArgs e)
|
||||
{
|
||||
var c = sender as ICommunicationMonitor;
|
||||
if (StatusListDeviceIndexes.ContainsKey(c))
|
||||
{
|
||||
var i = StatusListDeviceIndexes[c];
|
||||
StatusList.UShortInputSig(i, 1).UShortValue = (ushort)e.Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//using System;
|
||||
//using System.Linq;
|
||||
//using System.Collections.Generic;
|
||||
//using Crestron.SimplSharp;
|
||||
//using Crestron.SimplSharpPro;
|
||||
//using Crestron.SimplSharpPro.DeviceSupport;
|
||||
//using Crestron.SimplSharpPro.UI;
|
||||
|
||||
//using PepperDash.Core;
|
||||
//using PepperDash.Essentials.Core;
|
||||
//using PepperDash.Essentials.Core.SmartObjects;
|
||||
//using PepperDash.Essentials.Core.PageManagers;
|
||||
//using PepperDash.Essentials.Room.Config;
|
||||
|
||||
//namespace PepperDash.Essentials
|
||||
//{
|
||||
// public class EssentialsHuddleVtc1PresentationUiDriver : PanelDriverBase
|
||||
// {
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// EssentialsHuddleVtc1Room CurrentRoom;
|
||||
|
||||
|
||||
// public EssentialsHuddleVtc1PresentationUiDriver(BasicTriListWithSmartObject triList,
|
||||
// EssentialsHuddleVtc1Room room)
|
||||
// : base(triList)
|
||||
// {
|
||||
// CurrentRoom = room;
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// Smart Object 3200
|
||||
// /// </summary>
|
||||
// SubpageReferenceList SourceStagingSrl;
|
||||
|
||||
// /// <summary>
|
||||
// /// The AV page mangagers that have been used, to keep them alive for later
|
||||
// /// </summary>
|
||||
// Dictionary<object, PageManager> PageManagers = new Dictionary<object, PageManager>();
|
||||
|
||||
// /// <summary>
|
||||
// /// Current page manager running for a source
|
||||
// /// </summary>
|
||||
// PageManager CurrentSourcePageManager;
|
||||
|
||||
|
||||
// }
|
||||
//}
|
||||
File diff suppressed because it is too large
Load Diff
129
PepperDashEssentials/UIDrivers/JoinedSigInterlock.cs
Normal file
129
PepperDashEssentials/UIDrivers/JoinedSigInterlock.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// Very basic show/hide manager for weather page. Basic functionality is useful on any
|
||||
/// size of interface
|
||||
/// </summary>
|
||||
public class SingleSubpageModalAndBackDriver : PanelDriverBase
|
||||
{
|
||||
BoolInputSig SubpageSig;
|
||||
|
||||
PanelDriverBase Parent;
|
||||
|
||||
public SingleSubpageModalAndBackDriver(PanelDriverBase parent, uint subpageJoin) : base(parent.TriList)
|
||||
{
|
||||
Parent = parent;
|
||||
SubpageSig = Parent.TriList.BooleanInput[subpageJoin];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This shows the driver.
|
||||
/// Not sure I like this approach. Hides this and shows it's parent. Not really a navigation-stack type thing.
|
||||
/// The parent is always the home page driver
|
||||
/// </summary>
|
||||
public override void Show()
|
||||
{
|
||||
SubpageSig.BoolValue = true;
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
SubpageSig.BoolValue = false;
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
public override void BackButtonPressed()
|
||||
{
|
||||
Hide();
|
||||
Parent.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.UI;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// Very basic show/hide manager for weather page. Basic functionality is useful on any
|
||||
/// size of interface
|
||||
/// </summary>
|
||||
public class SingleSubpageModalDriver : PanelDriverBase
|
||||
{
|
||||
BoolInputSig SubpageSig;
|
||||
|
||||
public SingleSubpageModalDriver(PanelDriverBase parent, uint subpageJoin, uint closeJoin)
|
||||
: base(parent.TriList)
|
||||
{
|
||||
SubpageSig = parent.TriList.BooleanInput[subpageJoin];
|
||||
parent.TriList.SetSigFalseAction(closeJoin, Hide);
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
SubpageSig.BoolValue = true;
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
SubpageSig.BoolValue = false;
|
||||
base.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
99
PepperDashEssentials/UIDrivers/SigInterlock.cs
Normal file
99
PepperDashEssentials/UIDrivers/SigInterlock.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
/// Used for interlocking sigs, using a set-clears-last-set model.
|
||||
/// </summary>
|
||||
public class SigInterlock
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public BoolInputSig CurrentSig { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public SigInterlock()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides CurrentJoin and shows join. Does nothing when resending CurrentJoin
|
||||
/// </summary>
|
||||
public void ShowInterlocked(BoolInputSig sig)
|
||||
{
|
||||
if (CurrentSig == sig)
|
||||
return;
|
||||
SetButDontShow(sig);
|
||||
sig.BoolValue = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="join"></param>
|
||||
public void ShowInterlockedWithToggle(BoolInputSig sig)
|
||||
{
|
||||
if(CurrentSig == sig)
|
||||
HideAndClear();
|
||||
else
|
||||
{
|
||||
if(CurrentSig != null)
|
||||
CurrentSig.BoolValue = false;
|
||||
CurrentSig = sig;
|
||||
CurrentSig.BoolValue = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides current Sig and clears CurrentSig
|
||||
/// </summary>
|
||||
public void HideAndClear()
|
||||
{
|
||||
Hide();
|
||||
CurrentSig = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hides the current Sig but does not clear the selected Sig in case
|
||||
/// it needs to be reshown
|
||||
/// </summary>
|
||||
public void Hide()
|
||||
{
|
||||
if(CurrentSig != null)
|
||||
CurrentSig.BoolValue = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If CurrentSig is set, it restores that Sig
|
||||
/// </summary>
|
||||
public void Show()
|
||||
{
|
||||
if(CurrentSig != null)
|
||||
CurrentSig.BoolValue = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Useful for pre-setting the interlock but not enabling it. Sets CurrentSig
|
||||
/// </summary>
|
||||
/// <param name="join"></param>
|
||||
public void SetButDontShow(BoolInputSig sig)
|
||||
{
|
||||
if (CurrentSig != null)
|
||||
CurrentSig.BoolValue = false;
|
||||
CurrentSig = sig;
|
||||
}
|
||||
}
|
||||
}
|
||||
94
PepperDashEssentials/UIDrivers/SmartObjectRoomsList.cs
Normal file
94
PepperDashEssentials/UIDrivers/SmartObjectRoomsList.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public class SmartObjectRoomsList : SmartObjectDynamicList
|
||||
{
|
||||
public uint StatusSigOffset { get; private set; }
|
||||
List<SmartObjectRoomsListItem> Items;
|
||||
|
||||
public SmartObjectRoomsList(SmartObject so, uint nameSigOffset, uint statusSigOffset)
|
||||
: base(so, true, nameSigOffset)
|
||||
{
|
||||
StatusSigOffset = statusSigOffset;
|
||||
Items = new List<SmartObjectRoomsListItem>();
|
||||
}
|
||||
|
||||
public void AddRoomItem(SmartObjectRoomsListItem item)
|
||||
{
|
||||
Items.Add(item);
|
||||
}
|
||||
|
||||
public void SetItemStatusText(uint index, string text)
|
||||
{
|
||||
if (index > MaxCount) return;
|
||||
// The list item template defines CIPS tags that refer to standard joins
|
||||
(SmartObject.Device as BasicTriList).StringInput[StatusSigOffset + index].StringValue = text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets feedback for the given room
|
||||
/// </summary>
|
||||
public void SetFeedbackForRoom(EssentialsHuddleSpaceRoom room)
|
||||
{
|
||||
var itemToSet = Items.FirstOrDefault(i => i.Room == room);
|
||||
if (itemToSet != null)
|
||||
SetFeedback(itemToSet.Index, true);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmartObjectRoomsListItem
|
||||
{
|
||||
public EssentialsHuddleSpaceRoom Room { get; private set; }
|
||||
SmartObjectRoomsList Parent;
|
||||
public uint Index { get; private set; }
|
||||
|
||||
public SmartObjectRoomsListItem(EssentialsHuddleSpaceRoom room, uint index, SmartObjectRoomsList parent,
|
||||
Action<bool> buttonAction)
|
||||
{
|
||||
Room = room;
|
||||
Parent = parent;
|
||||
Index = index;
|
||||
if (room == null) return;
|
||||
|
||||
// Set "now" states
|
||||
parent.SetItemMainText(index, room.Name);
|
||||
UpdateItem(room.CurrentSourceInfo);
|
||||
// Watch for later changes
|
||||
room.CurrentSingleSourceChange += new SourceInfoChangeHandler(room_CurrentSourceInfoChange);
|
||||
parent.SetItemButtonAction(index, buttonAction);
|
||||
}
|
||||
|
||||
void room_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
|
||||
{
|
||||
UpdateItem(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper to handle source events and startup syncing with room's current source
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
void UpdateItem(SourceListItem info)
|
||||
{
|
||||
if (info == null || info.Type == eSourceListItemType.Off)
|
||||
{
|
||||
Parent.SetItemStatusText(Index, "");
|
||||
Parent.SetItemIcon(Index, "Blank");
|
||||
}
|
||||
else
|
||||
{
|
||||
Parent.SetItemStatusText(Index, info.PreferredName);
|
||||
Parent.SetItemIcon(Index, info.AltIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1173
PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs
Normal file
1173
PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,250 @@
|
||||
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;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.SmartObjects;
|
||||
using PepperDash.Essentials.Devices.Common.VideoCodec;
|
||||
|
||||
namespace PepperDash.Essentials.UIDrivers.VC
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This fella will likely need to interact with the room's source, although that is routed via the spark...
|
||||
/// Probably needs event or FB to feed AV driver - to show two-mute volume when appropriate.
|
||||
///
|
||||
/// </summary>
|
||||
public class EssentialsVideoCodecUiDriver : PanelDriverBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
VideoCodecBase Codec;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
SmartObjectDynamicList DirectorySrl; // ***************** SRL ???
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// To drive UI elements outside of this driver that may be dependent on this.
|
||||
/// </summary>
|
||||
BoolFeedback InCall;
|
||||
BoolFeedback LocalPrivacyIsMuted;
|
||||
|
||||
/// <summary>
|
||||
/// For the subpages above the bar
|
||||
/// </summary>
|
||||
JoinedSigInterlock VCControlsInterlock;
|
||||
|
||||
/// <summary>
|
||||
/// For the different staging bars: Active, inactive
|
||||
/// </summary>
|
||||
JoinedSigInterlock StagingBarInterlock;
|
||||
|
||||
/// <summary>
|
||||
/// For the staging button feedbacks
|
||||
/// </summary>
|
||||
JoinedSigInterlock StagingButtonFeedbackInterlock;
|
||||
|
||||
SmartObjectNumeric DialKeypad;
|
||||
|
||||
// These are likely temp until we get a keyboard built
|
||||
StringFeedback DialStringFeedback;
|
||||
StringBuilder DialStringBuilder = new StringBuilder();
|
||||
BoolFeedback DialStringBackspaceVisibleFeedback;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="triList"></param>
|
||||
/// <param name="codec"></param>
|
||||
public EssentialsVideoCodecUiDriver(BasicTriListWithSmartObject triList, VideoCodecBase codec)
|
||||
: base(triList)
|
||||
{
|
||||
Codec = codec;
|
||||
SetupCallStagingPopover();
|
||||
SetupDialKeypad();
|
||||
|
||||
InCall = new BoolFeedback(() => false);
|
||||
LocalPrivacyIsMuted = new BoolFeedback(() => false);
|
||||
|
||||
//DirectorySrl = new SubpageReferenceList(triList, UISmartObjectJoin.VCDirectoryList, 3, 3, 3);
|
||||
|
||||
VCControlsInterlock = new JoinedSigInterlock(triList);
|
||||
VCControlsInterlock.SetButDontShow(UIBoolJoin.VCDirectoryVisible);
|
||||
|
||||
StagingBarInterlock = new JoinedSigInterlock(triList);
|
||||
StagingBarInterlock.SetButDontShow(UIBoolJoin.VCStagingInactivePopoverVisible);
|
||||
|
||||
StagingButtonFeedbackInterlock = new JoinedSigInterlock(triList);
|
||||
StagingButtonFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCRecentsVisible);
|
||||
|
||||
DialStringFeedback = new StringFeedback(() => DialStringBuilder.ToString());
|
||||
DialStringFeedback.LinkInputSig(triList.StringInput[UIStringJoin.KeyboardText]);
|
||||
|
||||
DialStringBackspaceVisibleFeedback = new BoolFeedback(() => DialStringBuilder.Length > 0);
|
||||
DialStringBackspaceVisibleFeedback
|
||||
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.KeyboardClearVisible]);
|
||||
|
||||
Codec.ActiveCallCountFeedback.OutputChange += new EventHandler<EventArgs>(InCallFeedback_OutputChange);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void Show()
|
||||
{
|
||||
VCControlsInterlock.Show();
|
||||
StagingBarInterlock.Show();
|
||||
base.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public override void Hide()
|
||||
{
|
||||
VCControlsInterlock.Hide();
|
||||
StagingBarInterlock.Hide();
|
||||
base.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the call stage
|
||||
/// </summary>
|
||||
void SetupCallStagingPopover()
|
||||
{
|
||||
TriList.SetSigFalseAction(UIBoolJoin.VCStagingDirectoryPress, ShowDirectory);
|
||||
TriList.SetSigFalseAction(UIBoolJoin.VCStagingConnectPress, ConnectPress);
|
||||
TriList.SetSigFalseAction(UIBoolJoin.VCStagingKeypadPress, ShowKeypad);
|
||||
TriList.SetSigFalseAction(UIBoolJoin.VCStagingRecentsPress, ShowRecents);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void SetupDialKeypad()
|
||||
{
|
||||
if(TriList.SmartObjects.Contains(UISmartObjectJoin.VCDialKeypad))
|
||||
{
|
||||
DialKeypad = new SmartObjectNumeric(TriList.SmartObjects[UISmartObjectJoin.VCDialKeypad], true);
|
||||
DialKeypad.Digit0.SetSigFalseAction(() => DialKeypadPress("0"));
|
||||
DialKeypad.Digit1.SetSigFalseAction(() => DialKeypadPress("1"));
|
||||
DialKeypad.Digit2.SetSigFalseAction(() => DialKeypadPress("2"));
|
||||
DialKeypad.Digit3.SetSigFalseAction(() => DialKeypadPress("3"));
|
||||
DialKeypad.Digit4.SetSigFalseAction(() => DialKeypadPress("4"));
|
||||
DialKeypad.Digit5.SetSigFalseAction(() => DialKeypadPress("5"));
|
||||
DialKeypad.Digit6.SetSigFalseAction(() => DialKeypadPress("6"));
|
||||
DialKeypad.Digit7.SetSigFalseAction(() => DialKeypadPress("7"));
|
||||
DialKeypad.Digit8.SetSigFalseAction(() => DialKeypadPress("8"));
|
||||
DialKeypad.Digit9.SetSigFalseAction(() => DialKeypadPress("9"));
|
||||
DialKeypad.Misc1SigName = "*";
|
||||
DialKeypad.Misc1.SetSigFalseAction(() => DialKeypadPress("*"));
|
||||
DialKeypad.Misc2SigName = "#";
|
||||
DialKeypad.Misc2.SetSigFalseAction(() => DialKeypadPress("#"));
|
||||
TriList.SetSigFalseAction(UIBoolJoin.KeyboardClearPress, DialKeypadBackspacePress);
|
||||
}
|
||||
else
|
||||
Debug.Console(0, "Trilist {0:x2}, VC dial keypad object {1} not found. Check SGD file or VTP",
|
||||
TriList.ID, UISmartObjectJoin.VCDialKeypad);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void ShowCameraControls()
|
||||
{
|
||||
VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCCameraVisible);
|
||||
StagingButtonFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingCameraPress);
|
||||
}
|
||||
|
||||
void ShowKeypad()
|
||||
{
|
||||
VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible);
|
||||
StagingButtonFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress);
|
||||
}
|
||||
|
||||
void ShowDirectory()
|
||||
{
|
||||
// populate directory
|
||||
VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCDirectoryVisible);
|
||||
StagingButtonFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingDirectoryPress);
|
||||
}
|
||||
|
||||
void ShowRecents()
|
||||
{
|
||||
//populate recents
|
||||
VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCDirectoryVisible);
|
||||
StagingButtonFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingRecentsPress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void ConnectPress()
|
||||
{
|
||||
if (Codec.IsInCall)
|
||||
<<<<<<< HEAD
|
||||
Codec.EndCall("end whatever is selected");
|
||||
=======
|
||||
Codec.EndAllCalls();
|
||||
>>>>>>> origin/feature/cisco-spark-2
|
||||
else
|
||||
Codec.Dial(DialStringBuilder.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void InCallFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
var inCall = Codec.IsInCall;
|
||||
Debug.Console(1, "*#* Codec Driver InCallFeedback change={0}", InCall);
|
||||
TriList.UShortInput[UIUshortJoin.VCStagingConnectButtonMode].UShortValue = (ushort)(inCall ? 1 : 0);
|
||||
StagingBarInterlock.ShowInterlocked(
|
||||
inCall ? UIBoolJoin.VCStagingActivePopoverVisible : UIBoolJoin.VCStagingInactivePopoverVisible);
|
||||
|
||||
if (Codec.IsInCall) // Call is starting
|
||||
{
|
||||
// Header icon
|
||||
// Volume bar needs to have mic mute
|
||||
}
|
||||
else // ending
|
||||
{
|
||||
// Header icon
|
||||
// Volume bar no mic mute (or hidden if no source?)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="i"></param>
|
||||
void DialKeypadPress(string i)
|
||||
{
|
||||
DialStringBuilder.Append(i);
|
||||
DialStringFeedback.FireUpdate();
|
||||
TriList.BooleanInput[UIBoolJoin.KeyboardClearVisible].BoolValue =
|
||||
DialStringBuilder.Length > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
void DialKeypadBackspacePress()
|
||||
{
|
||||
DialStringBuilder.Remove(DialStringBuilder.Length - 1, 1);
|
||||
DialStringFeedback.FireUpdate();
|
||||
TriList.BooleanInput[UIBoolJoin.KeyboardClearVisible].BoolValue =
|
||||
DialStringBuilder.Length > 0;
|
||||
TriList.SetBool(UIBoolJoin.VCStagingConnectEnable, DialStringBuilder.Length > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
41
PepperDashEssentials/UIDrivers/VolumeAndSourceChangeArgs.cs
Normal file
41
PepperDashEssentials/UIDrivers/VolumeAndSourceChangeArgs.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class VolumeDeviceChangeEventArgs : EventArgs
|
||||
{
|
||||
public IBasicVolumeControls OldDev { get; private set; }
|
||||
public IBasicVolumeControls NewDev { get; private set; }
|
||||
public ChangeType Type { get; private set; }
|
||||
|
||||
public VolumeDeviceChangeEventArgs(IBasicVolumeControls oldDev, IBasicVolumeControls newDev, ChangeType type)
|
||||
{
|
||||
OldDev = oldDev;
|
||||
NewDev = newDev;
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The handler type for a Room's SourceInfoChange
|
||||
/// </summary>
|
||||
public delegate void SourceInfoChangeHandler(EssentialsRoomBase room, SourceListItem info, ChangeType type);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum ChangeType
|
||||
{
|
||||
WillChange, DidChange
|
||||
}
|
||||
}
|
||||
158
PepperDashEssentials/UIDrivers/enums and base.cs
Normal file
158
PepperDashEssentials/UIDrivers/enums and base.cs
Normal file
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials
|
||||
{
|
||||
public enum eAvSubpageType
|
||||
{
|
||||
NoControls,
|
||||
PowerOff,
|
||||
SetupFullDistributed,
|
||||
SourceWaitOverlay,
|
||||
TopBar,
|
||||
VolumePopup,
|
||||
ZoneSource
|
||||
}
|
||||
|
||||
public enum eAvSourceSubpageType
|
||||
{
|
||||
AppleTv,
|
||||
Radio,
|
||||
Roku
|
||||
}
|
||||
|
||||
public enum eCommonSubpageType
|
||||
{
|
||||
GenericModal,
|
||||
Home,
|
||||
PanelSetup,
|
||||
Weather
|
||||
}
|
||||
|
||||
public enum eAvSmartObjects
|
||||
{
|
||||
RoomList,
|
||||
SourceList
|
||||
}
|
||||
|
||||
public enum eCommonSmartObjects
|
||||
{
|
||||
HomePageList
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public abstract class PanelDriverBase
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsVisible { get; private set; }
|
||||
|
||||
public bool WasVisibleWhenHidden { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Makes sure you call this.
|
||||
/// Sets IsVisible and attaches back/home buttons to BackButtonPressed
|
||||
/// </summary>
|
||||
public virtual void Show()
|
||||
{
|
||||
IsVisible = true;
|
||||
TriList.SetSigFalseAction(15002, BackButtonPressed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will show if this was visible when Hide was called (for group hiding/showing)
|
||||
/// </summary>
|
||||
public void Restore()
|
||||
{
|
||||
if (WasVisibleWhenHidden)
|
||||
Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only sets IsVisible
|
||||
/// </summary>
|
||||
public virtual void Hide()
|
||||
{
|
||||
WasVisibleWhenHidden = IsVisible;
|
||||
IsVisible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggles visibility of this driver
|
||||
/// </summary>
|
||||
public virtual void Toggle()
|
||||
{
|
||||
if (IsVisible)
|
||||
Hide();
|
||||
else
|
||||
Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override with specific back button behavior. Default is empty
|
||||
/// </summary>
|
||||
public virtual void BackButtonPressed()
|
||||
{
|
||||
}
|
||||
|
||||
public PanelDriverBase(BasicTriListWithSmartObject triList)
|
||||
{
|
||||
TriList = triList;
|
||||
}
|
||||
|
||||
#region IBasicTriListWithSmartObject Members
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void AddSmartObjectHelper(uint id, object controller)
|
||||
{
|
||||
SmartObjectControllers.Add(id, controller);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void RemoveSmartObjectHelper(uint id)
|
||||
{
|
||||
SmartObjectControllers.Remove(id);
|
||||
}
|
||||
|
||||
Dictionary<uint, object> SmartObjectControllers = new Dictionary<uint, object>();
|
||||
|
||||
/// <summary>
|
||||
/// The trilist object for the Crestron TP device
|
||||
/// </summary>
|
||||
public BasicTriListWithSmartObject TriList { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public bool ContainsSmartObjectHelper(uint id)
|
||||
{
|
||||
return SmartObjectControllers.ContainsKey(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public object GetSmartObjectHelper(uint id)
|
||||
{
|
||||
if (SmartObjectControllers.ContainsKey(id))
|
||||
return SmartObjectControllers[id];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user