Renamed Config in Essentials room type classes to PropertiesConfig and modified EssentialsRoomBase to derive from ReconfigurableDevice

This commit is contained in:
Neil Dorin
2018-09-13 16:50:08 -06:00
parent 065075aabd
commit 8dabe732ec
14 changed files with 762 additions and 948 deletions

View File

@@ -76,7 +76,7 @@ namespace PepperDash.Essentials
avDriver.PopupInterlock.HideAndClear());
}
void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
public void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf)
{
// Help roomConf and popup
if (roomConf.Help != null)
@@ -107,7 +107,7 @@ namespace PepperDash.Essentials
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
as EssentialsHuddleSpaceRoom;
if (room != null)
message = room.Config.HelpMessage;
message = room.PropertiesConfig.HelpMessage;
else
message = "Sorry, no help message available. No room connected.";
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
@@ -227,7 +227,7 @@ namespace PepperDash.Essentials
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
var roomConf = currentRoom.Config;
var roomConf = currentRoom.PropertiesConfig;
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;
@@ -289,7 +289,7 @@ namespace PepperDash.Essentials
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
var roomConf = currentRoom.Config;
var roomConf = currentRoom.PropertiesConfig;
// Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it
Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged;

View File

@@ -164,7 +164,7 @@ namespace PepperDash.Essentials
get
{
if (_TechDriver == null)
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.Config.Tech);
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech);
return _TechDriver;
}
}
@@ -220,9 +220,7 @@ namespace PepperDash.Essentials
return;
}
var roomConf = CurrentRoom.Config;
TriList.SetString(UIStringJoin.CurrentRoomName, CurrentRoom.Name);
var roomConf = CurrentRoom.PropertiesConfig;
if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero)
{
@@ -724,63 +722,58 @@ namespace PepperDash.Essentials
CurrentRoom.CurrentVolumeControls.VolumeDown(state);
}
/// <summary>
/// Helper for property setter. Sets the panel to the given room, latching up all functionality
/// </summary>
void SetCurrentRoom(EssentialsHuddleSpaceRoom room)
{
if (_CurrentRoom == room) return;
// Disconnect current (probably never called)
if (_CurrentRoom != null)
{
// Disconnect current room
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
public void RefreshCurrentRoom(EssentialsHuddleSpaceRoom room)
{
if (_CurrentRoom != null)
{
// Disconnect current room
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange -= this.CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo);
_CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
_CurrentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled;
_CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange;
_CurrentRoom.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange;
}
_CurrentRoom = room;
_CurrentRoom = room;
if (_CurrentRoom != null)
{
// get the source list config and set up the source list
var config = ConfigReader.ConfigObject.SourceLists;
if (config.ContainsKey(_CurrentRoom.SourceListKey))
{
var srcList = config[_CurrentRoom.SourceListKey];
// Setup sources list
uint i = 1; // counter for UI list
foreach (var kvp in srcList)
{
var srcConfig = kvp.Value;
if (!srcConfig.IncludeInSourceList) // Skip sources marked this way
continue;
if (_CurrentRoom != null)
{
// get the source list config and set up the source list
var config = ConfigReader.ConfigObject.SourceLists;
if (config.ContainsKey(_CurrentRoom.SourceListKey))
{
var srcList = config[_CurrentRoom.SourceListKey];
// Setup sources list
uint i = 1; // counter for UI list
foreach (var kvp in srcList)
{
var srcConfig = kvp.Value;
if (!srcConfig.IncludeInSourceList) // Skip sources marked this way
continue;
var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device;
if (actualSource == null)
{
Debug.Console(1, "Cannot assign missing source '{0}' to source UI list",
srcConfig.SourceKey);
continue;
}
var routeKey = kvp.Key;
var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device;
if (actualSource == null)
{
Debug.Console(1, "Cannot assign missing source '{0}' to source UI list",
srcConfig.SourceKey);
continue;
}
var routeKey = kvp.Key;
var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig,
b => { if (!b) UiSelectSource(routeKey); });
SourcesSrl.AddItem(item); // add to the SRL
item.RegisterForSourceChange(_CurrentRoom);
}
}
SourcesSrl.Count = (ushort)(i - 1);
}
}
// Name and logo
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name;
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name;
if (_CurrentRoom.LogoUrl == null)
{
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true;
@@ -804,98 +797,31 @@ namespace PepperDash.Essentials
_CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange;
_CurrentRoom.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange;
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo();
(Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(this, CurrentRoom);
}
else
{
// Clear sigs that need to be
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room";
}
else
{
// Clear sigs that need to be
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room";
}
}
/// <summary>
/// Helper for property setter. Sets the panel to the given room, latching up all functionality
/// </summary>
void SetCurrentRoom(EssentialsHuddleSpaceRoom room)
{
if (_CurrentRoom == room) return;
// Disconnect current (probably never called)
RefreshCurrentRoom(room);
}
//void SetupHeaderButtons()
//{
// HeaderButtonsAreSetUp = false;
// TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
// var roomConf = CurrentRoom.Config;
// // Gear
// TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear");
// TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000,
// ShowTech,
// null,
// () =>
// {
// if (CurrentRoom.OnFeedback.BoolValue)
// PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible);
// else
// PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible);
// });
// TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
// PopupInterlock.HideAndClear());
// // Help button and popup
// if (CurrentRoom.Config.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, CurrentRoom.Config.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;
// PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible);
// });
// uint nextJoin = 3953;
// //// Calendar button
// //if (_CurrentRoom.ScheduleSource != null)
// //{
// // TriList.SetString(nextJoin, "Calendar");
// // TriList.SetSigFalseAction(nextJoin, CalendarPress);
// // nextJoin--;
// //}
// //nextJoin--;
// // blank any that remain
// for (var i = nextJoin; i > 3950; i--)
// {
// TriList.SetString(i, "Blank");
// TriList.SetSigFalseAction(i, () => { });
// }
// HeaderButtonsAreSetUp = true;
//}
/// <summary>
/// For room on/off changes
/// </summary>

View File

@@ -155,7 +155,7 @@ namespace PepperDash.Essentials
get
{
if (_TechDriver == null)
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.Config.Tech);
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech);
return _TechDriver;
}
}
@@ -235,9 +235,7 @@ namespace PepperDash.Essentials
return;
}
var roomConf = CurrentRoom.Config;
TriList.SetString(UIStringJoin.CurrentRoomName, CurrentRoom.Name);
var roomConf = CurrentRoom.PropertiesConfig;
if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero)
{
@@ -894,7 +892,7 @@ namespace PepperDash.Essentials
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
_CurrentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled;
_CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange;
_CurrentRoom.IsCoolingDownFeedback.OutputChange -= CurrentRoom_IsCoolingDownFeedback_OutputChange;
_CurrentRoom.InCallFeedback.OutputChange -= CurrentRoom_InCallFeedback_OutputChange;
@@ -1066,155 +1064,6 @@ namespace PepperDash.Essentials
TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = callListSharedSourceLabel;
}
///// <summary>
/////
///// </summary>
//void SetupHeaderButtons()
//{
// HeaderButtonsAreSetUp = false;
// TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
// var roomConf = CurrentRoom.Config;
// // Gear
// TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear");
// TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000,
// ShowTech,
// null,
// () =>
// {
// if (CurrentRoom.OnFeedback.BoolValue)
// PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible);
// else
// PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible);
// });
// TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
// PopupInterlock.HideAndClear());
// // Help button and popup
// if (CurrentRoom.Config.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, CurrentRoom.Config.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;
// PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible);
// });
// uint nextJoin = 3953;
// // Calendar button
// if (_CurrentRoom.ScheduleSource != null)
// {
// TriList.SetString(nextJoin, "Calendar");
// TriList.SetSigFalseAction(nextJoin, CalendarPress);
// nextJoin--;
// }
// // Call button
// TriList.SetString(nextJoin, "DND");
// TriList.SetSigFalseAction(nextJoin, ShowActiveCallsList);
// HeaderCallButtonIconSig = TriList.StringInput[nextJoin];
// nextJoin--;
// // blank any that remain
// for (var i = nextJoin; i > 3950; i--)
// {
// TriList.SetString(i, "Blank");
// TriList.SetSigFalseAction(i, () => { });
// }
// TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, 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>
///// 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>
///
/// </summary>