refactoring and cleanup

This commit is contained in:
Andrew Welker
2020-06-24 14:30:01 -06:00
parent e84423eb64
commit 43e39a5222

View File

@@ -2,13 +2,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.UI;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.PageManagers; using PepperDash.Essentials.Core.PageManagers;
using PepperDash.Essentials.UIDrivers;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
@@ -17,7 +15,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver
{ {
CrestronTouchpanelPropertiesConfig Config; private readonly CrestronTouchpanelPropertiesConfig _config;
public enum UiDisplayMode public enum UiDisplayMode
{ {
@@ -38,8 +36,8 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public uint VolumeButtonPopupTimeout public uint VolumeButtonPopupTimeout
{ {
get { return VolumeButtonsPopupFeedback.TimeoutMs; } get { return _volumeButtonsPopupFeedback.TimeoutMs; }
set { VolumeButtonsPopupFeedback.TimeoutMs = value; } set { _volumeButtonsPopupFeedback.TimeoutMs = value; }
} }
/// <summary> /// <summary>
@@ -47,8 +45,8 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public uint VolumeGaugePopupTimeout public uint VolumeGaugePopupTimeout
{ {
get { return VolumeGaugeFeedback.TimeoutMs; } get { return _volumeGaugeFeedback.TimeoutMs; }
set { VolumeGaugeFeedback.TimeoutMs = value; } set { _volumeGaugeFeedback.TimeoutMs = value; }
} }
/// <summary> /// <summary>
@@ -56,21 +54,12 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public uint PowerOffTimeout { get; set; } public uint PowerOffTimeout { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public string DefaultRoomKey public string DefaultRoomKey { get; set; }
{
get { return _DefaultRoomKey; }
set
{
_DefaultRoomKey = value;
//CurrentRoom = DeviceManager.GetDeviceForKey(value) as EssentialsHuddleSpaceRoom;
}
}
string _DefaultRoomKey;
/// <summary> /// <summary>
/// Indicates that the SetHeaderButtons method has completed successfully /// Indicates that the SetHeaderButtons method has completed successfully
/// </summary> /// </summary>
public bool HeaderButtonsAreSetUp { get; private set; } public bool HeaderButtonsAreSetUp { get; private set; }
@@ -80,13 +69,13 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public EssentialsHuddleSpaceRoom CurrentRoom public EssentialsHuddleSpaceRoom CurrentRoom
{ {
get { return _CurrentRoom; } get { return _currentRoom; }
set set
{ {
SetCurrentRoom(value); SetCurrentRoom(value);
} }
} }
EssentialsHuddleSpaceRoom _CurrentRoom; EssentialsHuddleSpaceRoom _currentRoom;
/// <summary> /// <summary>
/// ///
@@ -96,88 +85,86 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// For hitting feedback /// For hitting feedback
/// </summary> /// </summary>
BoolInputSig ShareButtonSig; private readonly BoolInputSig _shareButtonSig;
BoolInputSig EndMeetingButtonSig; private BoolInputSig _endMeetingButtonSig;
/// <summary> /// <summary>
/// Controls the extended period that the volume gauge shows on-screen, /// Controls the extended period that the volume gauge shows on-screen,
/// as triggered by Volume up/down operations /// as triggered by Volume up/down operations
/// </summary> /// </summary>
BoolFeedbackPulseExtender VolumeGaugeFeedback; private readonly BoolFeedbackPulseExtender _volumeGaugeFeedback;
/// <summary> /// <summary>
/// Controls the period that the volume buttons show on non-hard-button /// Controls the period that the volume buttons show on non-hard-button
/// interfaces /// interfaces
/// </summary> /// </summary>
BoolFeedbackPulseExtender VolumeButtonsPopupFeedback; private readonly BoolFeedbackPulseExtender _volumeButtonsPopupFeedback;
/// <summary> /// <summary>
/// The parent driver for this /// The parent driver for this
/// </summary> /// </summary>
public PanelDriverBase Parent { get; private set; } private readonly PanelDriverBase _parent;
/// <summary> /// <summary>
/// All children attached to this driver. For hiding and showing as a group. /// All children attached to this driver. For hiding and showing as a group.
/// </summary> /// </summary>
List<PanelDriverBase> ChildDrivers = new List<PanelDriverBase>(); private List<PanelDriverBase> _childDrivers = new List<PanelDriverBase>();
List<BoolInputSig> CurrentDisplayModeSigsInUse = new List<BoolInputSig>(); private readonly List<BoolInputSig> _currentDisplayModeSigsInUse = new List<BoolInputSig>();
//// Important smart objects //// Important smart objects
/// <summary> /// <summary>
/// Smart Object 3200 /// Smart Object 3200
/// </summary> /// </summary>
SubpageReferenceList SourcesSrl; private readonly SubpageReferenceList _sourcesSrl;
/// <summary> /// <summary>
/// Smart Object 15022 /// Smart Object 15022
/// </summary> /// </summary>
SubpageReferenceList ActivityFooterSrl; private readonly SubpageReferenceList _activityFooterSrl;
/// <summary> /// <summary>
/// Tracks which audio page group the UI is in /// Tracks which audio page group the UI is in
/// </summary> /// </summary>
UiDisplayMode CurrentDisplayMode; private UiDisplayMode _currentDisplayMode;
/// <summary> /// <summary>
/// The AV page mangagers that have been used, to keep them alive for later /// The AV page mangagers that have been used, to keep them alive for later
/// </summary> /// </summary>
Dictionary<object, PageManager> PageManagers = new Dictionary<object, PageManager>(); private readonly Dictionary<object, PageManager> _pageManagers = new Dictionary<object, PageManager>();
/// <summary> /// <summary>
/// Current page manager running for a source /// Current page manager running for a source
/// </summary> /// </summary>
PageManager CurrentSourcePageManager; private PageManager _currentSourcePageManager;
/// <summary> /// <summary>
/// Will auto-timeout a power off /// Will auto-timeout a power off
/// </summary> /// </summary>
CTimer PowerOffTimer; private CTimer _powerOffTimer;
ModalDialog PowerDownModal; private ModalDialog _powerDownModal;
public JoinedSigInterlock PopupInterlock { get; private set; } public JoinedSigInterlock PopupInterlock { get; private set; }
/// <summary> /// <summary>
/// The driver for the tech page. Lazy getter for memory usage /// The driver for the tech page. Lazy getter for memory usage
/// </summary> /// </summary>
PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver TechDriver EssentialsHuddleTechPageDriver TechDriver
{ {
get get {
{ return _techDriver ??
if (_TechDriver == null) (_techDriver = new EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech));
_TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, CurrentRoom.PropertiesConfig.Tech);
return _TechDriver;
} }
} }
PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver _TechDriver; private EssentialsHuddleTechPageDriver _techDriver;
/// <summary> /// <summary>
/// Controls timeout of notification ribbon timer /// Controls timeout of notification ribbon timer
/// </summary> /// </summary>
CTimer RibbonTimer; private CTimer _ribbonTimer;
/// <summary> /// <summary>
/// Constructor /// Constructor
@@ -185,25 +172,25 @@ namespace PepperDash.Essentials
public EssentialsHuddlePanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config) public EssentialsHuddlePanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config)
: base(parent.TriList) : base(parent.TriList)
{ {
Config = config; _config = config;
Parent = parent; _parent = parent;
PopupInterlock = new JoinedSigInterlock(TriList); PopupInterlock = new JoinedSigInterlock(TriList);
SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3); _sourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3); _activityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3);
ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1); _shareButtonSig = _activityFooterSrl.BoolInputSig(1, 1);
SetupActivityFooterWhenRoomOff(); SetupActivityFooterWhenRoomOff();
ShowVolumeGauge = true; ShowVolumeGauge = true;
// One-second pulse extender for volume gauge // One-second pulse extender for volume gauge
VolumeGaugeFeedback = new BoolFeedbackPulseExtender(1500); _volumeGaugeFeedback = new BoolFeedbackPulseExtender(1500);
VolumeGaugeFeedback.Feedback _volumeGaugeFeedback.Feedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeGaugePopupVisible]); .LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeGaugePopupVisible]);
VolumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000); _volumeButtonsPopupFeedback = new BoolFeedbackPulseExtender(4000);
VolumeButtonsPopupFeedback.Feedback _volumeButtonsPopupFeedback.Feedback
.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeButtonPopupVisible]); .LinkInputSig(TriList.BooleanInput[UIBoolJoin.VolumeButtonPopupVisible]);
PowerOffTimeout = 30000; PowerOffTimeout = 30000;
@@ -224,7 +211,15 @@ namespace PepperDash.Essentials
return; return;
} }
var roomConf = CurrentRoom.PropertiesConfig; switch (_config.HeaderStyle.ToLower())
{
case CrestronTouchpanelPropertiesConfig.Habanero:
TriList.SetSigFalseAction(UIBoolJoin.HeaderRoomButtonPress, () =>
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.RoomHeaderPageVisible));
break;
case CrestronTouchpanelPropertiesConfig.Verbose:
break;
}
if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero) if (Config.HeaderStyle.ToLower() == CrestronTouchpanelPropertiesConfig.Habanero)
{ {
@@ -374,7 +369,7 @@ namespace PepperDash.Essentials
TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = false; TriList.BooleanInput[UIBoolJoin.TapToBeginVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
//TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = false; //TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = false;
VolumeButtonsPopupFeedback.ClearNow(); _volumeButtonsPopupFeedback.ClearNow();
//CancelPowerOff(); //CancelPowerOff();
base.Hide(); base.Hide();
@@ -391,12 +386,12 @@ namespace PepperDash.Essentials
TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, true); TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, true);
if (timeout > 0) if (timeout > 0)
{ {
if (RibbonTimer != null) if (_ribbonTimer != null)
RibbonTimer.Stop(); _ribbonTimer.Stop();
RibbonTimer = new CTimer(o => _ribbonTimer = new CTimer(o =>
{ {
TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false); TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false);
RibbonTimer = null; _ribbonTimer = null;
}, timeout); }, timeout);
} }
} }
@@ -407,10 +402,10 @@ namespace PepperDash.Essentials
public void HideNotificationRibbon() public void HideNotificationRibbon()
{ {
TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false); TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false);
if (RibbonTimer != null) if (_ribbonTimer != null)
{ {
RibbonTimer.Stop(); _ribbonTimer.Stop();
RibbonTimer = null; _ribbonTimer = null;
} }
} }
@@ -422,7 +417,7 @@ namespace PepperDash.Essentials
{ {
//Clear whatever is showing now. //Clear whatever is showing now.
HideAndClearCurrentDisplayModeSigsInUse(); HideAndClearCurrentDisplayModeSigsInUse();
CurrentDisplayMode = mode; _currentDisplayMode = mode;
switch (mode) switch (mode)
{ {
case UiDisplayMode.PresentationMode: case UiDisplayMode.PresentationMode:
@@ -440,7 +435,7 @@ namespace PepperDash.Essentials
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
} }
// Date/time // Date/time
if (Config.ShowDate && Config.ShowTime) if (_config.ShowDate && _config.ShowTime)
{ {
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = true; TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = false; TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = false;
@@ -449,8 +444,8 @@ namespace PepperDash.Essentials
else else
{ {
TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = false; TriList.BooleanInput[UIBoolJoin.DateAndTimeVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = Config.ShowDate; TriList.BooleanInput[UIBoolJoin.DateOnlyVisible].BoolValue = _config.ShowDate;
TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = Config.ShowTime; TriList.BooleanInput[UIBoolJoin.TimeOnlyVisible].BoolValue = _config.ShowTime;
} }
ShowCurrentDisplayModeSigsInUse(); ShowCurrentDisplayModeSigsInUse();
@@ -463,12 +458,12 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
void SetupActivityFooterWhenRoomOff() void SetupActivityFooterWhenRoomOff()
{ {
ActivityFooterSrl.Clear(); _activityFooterSrl.Clear();
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, 0, _activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, _activityFooterSrl, 0,
b => { if (!b) ShareButtonPressed(); })); b => { if (!b) ShareButtonPressed(); }));
ActivityFooterSrl.Count = 1; _activityFooterSrl.Count = 1;
TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 0; TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 0;
ShareButtonSig.BoolValue = false; _shareButtonSig.BoolValue = false;
} }
/// <summary> /// <summary>
@@ -476,15 +471,15 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
void SetupActivityFooterWhenRoomOn() void SetupActivityFooterWhenRoomOn()
{ {
ActivityFooterSrl.Clear(); _activityFooterSrl.Clear();
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, ActivityFooterSrl, _activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, _activityFooterSrl,
0, null)); 0, null));
ActivityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, ActivityFooterSrl, _activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, _activityFooterSrl,
4, b => { if (!b) PowerButtonPressed(); })); 4, b => { if (!b) PowerButtonPressed(); }));
ActivityFooterSrl.Count = 2; _activityFooterSrl.Count = 2;
TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 1; TriList.UShortInput[UIUshortJoin.PresentationStagingCaretMode].UShortValue = 1;
EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(2, 1); _endMeetingButtonSig = _activityFooterSrl.BoolInputSig(2, 1);
ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue; _shareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
} }
/// <summary> /// <summary>
@@ -492,8 +487,8 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
void ShareButtonPressed() void ShareButtonPressed()
{ {
ShareButtonSig.BoolValue = true; _shareButtonSig.BoolValue = true;
TriList.BooleanInput[StartPageVisibleJoin].BoolValue = false; TriList.BooleanInput[UIBoolJoin.StartPageVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = true; TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true; TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true;
// Run default source when room is off and share is pressed // Run default source when room is off and share is pressed
@@ -507,7 +502,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
void ShowCurrentDisplayModeSigsInUse() void ShowCurrentDisplayModeSigsInUse()
{ {
foreach (var sig in CurrentDisplayModeSigsInUse) foreach (var sig in _currentDisplayModeSigsInUse)
sig.BoolValue = true; sig.BoolValue = true;
} }
@@ -516,9 +511,9 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
void HideAndClearCurrentDisplayModeSigsInUse() void HideAndClearCurrentDisplayModeSigsInUse()
{ {
foreach (var sig in CurrentDisplayModeSigsInUse) foreach (var sig in _currentDisplayModeSigsInUse)
sig.BoolValue = false; sig.BoolValue = false;
CurrentDisplayModeSigsInUse.Clear(); _currentDisplayModeSigsInUse.Clear();
} }
/// <summary> /// <summary>
@@ -526,7 +521,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public override void BackButtonPressed() public override void BackButtonPressed()
{ {
switch (CurrentDisplayMode) switch (_currentDisplayMode)
{ {
case UiDisplayMode.PresentationMode: case UiDisplayMode.PresentationMode:
//CancelReturnToSourceTimer(); //CancelReturnToSourceTimer();
@@ -541,7 +536,7 @@ namespace PepperDash.Essentials
void BackToHome() void BackToHome()
{ {
Hide(); Hide();
Parent.Show(); _parent.Show();
} }
/// <summary> /// <summary>
@@ -553,26 +548,28 @@ namespace PepperDash.Essentials
return; return;
var uiDev = CurrentRoom.CurrentSourceInfo.SourceDevice as IUiDisplayInfo; var uiDev = CurrentRoom.CurrentSourceInfo.SourceDevice as IUiDisplayInfo;
PageManager pm = null; // If we need a page manager, get an appropriate one
// If we need a page manager, get an appropriate one if (uiDev == null)
if (uiDev != null) {
{ return;
TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; }
// Got an existing page manager, get it
if (PageManagers.ContainsKey(uiDev)) TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
pm = PageManagers[uiDev]; // Got an existing page manager, get it
// Otherwise make an apporiate one PageManager pm;
else if (uiDev is ISetTopBoxControls) if (_pageManagers.ContainsKey(uiDev))
//pm = new SetTopBoxMediumPageManager(uiDev as ISetTopBoxControls, TriList); pm = _pageManagers[uiDev];
pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList); // Otherwise make an apporiate one
else if (uiDev is IDiscPlayerControls) else if (uiDev is ISetTopBoxControls)
pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList); //pm = new SetTopBoxMediumPageManager(uiDev as ISetTopBoxControls, TriList);
else pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList);
pm = new DefaultPageManager(uiDev, TriList); else if (uiDev is IDiscPlayerControls)
PageManagers[uiDev] = pm; pm = new DiscPlayerMediumPageManager(uiDev as IDiscPlayerControls, TriList);
CurrentSourcePageManager = pm; else
pm.Show(); pm = new DefaultPageManager(uiDev, TriList);
} _pageManagers[uiDev] = pm;
_currentSourcePageManager = pm;
pm.Show();
} }
/// <summary> /// <summary>
@@ -583,7 +580,7 @@ namespace PepperDash.Essentials
void UiSelectSource(string key) void UiSelectSource(string key)
{ {
// Run the route and when it calls back, show the source // Run the route and when it calls back, show the source
CurrentRoom.RunRouteAction(key, new Action(() => { })); CurrentRoom.RunRouteAction(key, () => { });
} }
/// <summary> /// <summary>
@@ -607,12 +604,12 @@ namespace PepperDash.Essentials
{ {
// Do we need to check where the UI is? No? // Do we need to check where the UI is? No?
var timer = CurrentRoom.ShutdownPromptTimer; var timer = CurrentRoom.ShutdownPromptTimer;
EndMeetingButtonSig.BoolValue = true; _endMeetingButtonSig.BoolValue = true;
ShareButtonSig.BoolValue = false; _shareButtonSig.BoolValue = false;
if (CurrentRoom.ShutdownType == eShutdownType.Manual || CurrentRoom.ShutdownType == eShutdownType.Vacancy) if (CurrentRoom.ShutdownType == eShutdownType.Manual || CurrentRoom.ShutdownType == eShutdownType.Vacancy)
{ {
PowerDownModal = new ModalDialog(TriList); _powerDownModal = new ModalDialog(TriList);
var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds); var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds);
// Attach timer things to modal // Attach timer things to modal
@@ -626,15 +623,15 @@ namespace PepperDash.Essentials
{ {
if (!onFb.BoolValue) if (!onFb.BoolValue)
{ {
EndMeetingButtonSig.BoolValue = false; _endMeetingButtonSig.BoolValue = false;
PowerDownModal.HideDialog(); _powerDownModal.HideDialog();
onFb.OutputChange -= offHandler; onFb.OutputChange -= offHandler;
//gauge.OutputChange -= gaugeHandler; //gauge.OutputChange -= gaugeHandler;
} }
}; };
onFb.OutputChange += offHandler; onFb.OutputChange += offHandler;
PowerDownModal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, true, _powerDownModal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, true,
but => but =>
{ {
if (but != 2) // any button except for End cancels if (but != 2) // any button except for End cancels
@@ -652,7 +649,7 @@ namespace PepperDash.Essentials
/// <param name="e"></param> /// <param name="e"></param>
void ShutdownPromptTimer_HasFinished(object sender, EventArgs e) void ShutdownPromptTimer_HasFinished(object sender, EventArgs e)
{ {
EndMeetingButtonSig.BoolValue = false; _endMeetingButtonSig.BoolValue = false;
CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= ShutdownPromptTimer_TimeRemainingFeedback_OutputChange;
CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange; CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange;
} }
@@ -664,10 +661,10 @@ namespace PepperDash.Essentials
/// <param name="e"></param> /// <param name="e"></param>
void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e) void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e)
{ {
if (PowerDownModal != null) if (_powerDownModal != null)
PowerDownModal.HideDialog(); _powerDownModal.HideDialog();
EndMeetingButtonSig.BoolValue = false; _endMeetingButtonSig.BoolValue = false;
ShareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue; _shareButtonSig.BoolValue = CurrentRoom.OnFeedback.BoolValue;
CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += ShutdownPromptTimer_TimeRemainingFeedback_OutputChange;
CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange; CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= ShutdownPromptTimer_PercentFeedback_OutputChange;
@@ -675,27 +672,38 @@ namespace PepperDash.Essentials
void ShutdownPromptTimer_TimeRemainingFeedback_OutputChange(object sender, EventArgs e) void ShutdownPromptTimer_TimeRemainingFeedback_OutputChange(object sender, EventArgs e)
{ {
var stringFeedback = sender as StringFeedback;
if (stringFeedback == null)
{
return;
}
var message = string.Format("Meeting will end in {0} seconds", (sender as StringFeedback).StringValue); var message = string.Format("Meeting will end in {0} seconds", stringFeedback.StringValue);
TriList.StringInput[ModalDialog.MessageTextJoin].StringValue = message; TriList.StringInput[ModalDialog.MessageTextJoin].StringValue = message;
} }
void ShutdownPromptTimer_PercentFeedback_OutputChange(object sender, EventArgs e) void ShutdownPromptTimer_PercentFeedback_OutputChange(object sender, EventArgs e)
{ {
var value = (ushort)((sender as IntFeedback).UShortValue * 65535 / 100); var intFeedback = sender as IntFeedback;
TriList.UShortInput[ModalDialog.TimerGaugeJoin].UShortValue = value; if (intFeedback == null)
} {
return;
}
var value = (ushort)(intFeedback.UShortValue * 65535 / 100);
TriList.UShortInput[ModalDialog.TimerGaugeJoin].UShortValue = value;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
void CancelPowerOffTimer() void CancelPowerOffTimer()
{ {
if (PowerOffTimer != null) if (_powerOffTimer == null)
{ {
PowerOffTimer.Stop(); return;
PowerOffTimer = null; }
} _powerOffTimer.Stop();
_powerOffTimer = null;
} }
/// <summary> /// <summary>
@@ -703,13 +711,13 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
void VolumeButtonsTogglePress() void VolumeButtonsTogglePress()
{ {
if (VolumeButtonsPopupFeedback.BoolValue) if (_volumeButtonsPopupFeedback.BoolValue)
VolumeButtonsPopupFeedback.ClearNow(); _volumeButtonsPopupFeedback.ClearNow();
else else
{ {
// Trigger the popup // Trigger the popup
VolumeButtonsPopupFeedback.BoolValue = true; _volumeButtonsPopupFeedback.BoolValue = true;
VolumeButtonsPopupFeedback.BoolValue = false; _volumeButtonsPopupFeedback.BoolValue = false;
} }
} }
@@ -721,8 +729,8 @@ namespace PepperDash.Essentials
{ {
// extend timeouts // extend timeouts
if (ShowVolumeGauge) if (ShowVolumeGauge)
VolumeGaugeFeedback.BoolValue = state; _volumeGaugeFeedback.BoolValue = state;
VolumeButtonsPopupFeedback.BoolValue = state; _volumeButtonsPopupFeedback.BoolValue = state;
if (CurrentRoom.CurrentVolumeControls != null) if (CurrentRoom.CurrentVolumeControls != null)
CurrentRoom.CurrentVolumeControls.VolumeUp(state); CurrentRoom.CurrentVolumeControls.VolumeUp(state);
} }
@@ -735,8 +743,8 @@ namespace PepperDash.Essentials
{ {
// extend timeouts // extend timeouts
if (ShowVolumeGauge) if (ShowVolumeGauge)
VolumeGaugeFeedback.BoolValue = state; _volumeGaugeFeedback.BoolValue = state;
VolumeButtonsPopupFeedback.BoolValue = state; _volumeButtonsPopupFeedback.BoolValue = state;
if (CurrentRoom.CurrentVolumeControls != null) if (CurrentRoom.CurrentVolumeControls != null)
CurrentRoom.CurrentVolumeControls.VolumeDown(state); CurrentRoom.CurrentVolumeControls.VolumeDown(state);
} }
@@ -747,31 +755,31 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void RefreshCurrentRoom(EssentialsHuddleSpaceRoom room) public void RefreshCurrentRoom(EssentialsHuddleSpaceRoom room)
{ {
if (_CurrentRoom != null) if (_currentRoom != null)
{ {
// Disconnect current room // Disconnect current room
_CurrentRoom.CurrentVolumeDeviceChange -= this.CurrentRoom_CurrentAudioDeviceChange; _currentRoom.CurrentVolumeDeviceChange -= CurrentRoom_CurrentAudioDeviceChange;
ClearAudioDeviceConnections(); ClearAudioDeviceConnections();
_CurrentRoom.CurrentSourceChange -= this.CurrentRoom_SourceInfoChange; _currentRoom.CurrentSourceChange -= CurrentRoom_SourceInfoChange;
DisconnectSource(_CurrentRoom.CurrentSourceInfo); DisconnectSource(_currentRoom.CurrentSourceInfo);
_CurrentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted; _currentRoom.ShutdownPromptTimer.HasStarted -= ShutdownPromptTimer_HasStarted;
_CurrentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished; _currentRoom.ShutdownPromptTimer.HasFinished -= ShutdownPromptTimer_HasFinished;
_CurrentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled; _currentRoom.ShutdownPromptTimer.WasCancelled -= ShutdownPromptTimer_WasCancelled;
_CurrentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange; _currentRoom.OnFeedback.OutputChange -= CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange; _currentRoom.IsWarmingUpFeedback.OutputChange -= CurrentRoom_IsWarmingFeedback_OutputChange;
_CurrentRoom.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange; _currentRoom.IsCoolingDownFeedback.OutputChange -= IsCoolingDownFeedback_OutputChange;
} }
_CurrentRoom = room; _currentRoom = room;
if (_CurrentRoom != null) if (_currentRoom != null)
{ {
// get the source list config and set up the source list // get the source list config and set up the source list
var config = ConfigReader.ConfigObject.SourceLists; var config = ConfigReader.ConfigObject.SourceLists;
if (config.ContainsKey(_CurrentRoom.SourceListKey)) if (config.ContainsKey(_currentRoom.SourceListKey))
{ {
var srcList = config[_CurrentRoom.SourceListKey]; var srcList = config[_currentRoom.SourceListKey];
// Setup sources list // Setup sources list
uint i = 1; // counter for UI list uint i = 1; // counter for UI list
foreach (var kvp in srcList) foreach (var kvp in srcList)
@@ -788,16 +796,16 @@ namespace PepperDash.Essentials
continue; continue;
} }
var routeKey = kvp.Key; var routeKey = kvp.Key;
var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig, var item = new SubpageReferenceListSourceItem(i++, _sourcesSrl, srcConfig,
b => { if (!b) UiSelectSource(routeKey); }); b => { if (!b) UiSelectSource(routeKey); });
SourcesSrl.AddItem(item); // add to the SRL _sourcesSrl.AddItem(item); // add to the SRL
item.RegisterForSourceChange(_CurrentRoom); item.RegisterForSourceChange(_currentRoom);
} }
SourcesSrl.Count = (ushort)(i - 1); _sourcesSrl.Count = (ushort)(i - 1);
} }
// Name and logo // Name and logo
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name; TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _currentRoom.Name;
if (_CurrentRoom.LogoUrlLightBkgnd == null) if (_currentRoom.LogoUrlLightBkgnd == null)
{ {
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true; TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true;
TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = false; TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = false;
@@ -806,28 +814,33 @@ namespace PepperDash.Essentials
{ {
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = false; TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = false;
TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = true; TriList.BooleanInput[UIBoolJoin.LogoUrlVisible].BoolValue = true;
TriList.StringInput[UIStringJoin.LogoUrlLightBkgnd].StringValue = _CurrentRoom.LogoUrlLightBkgnd; TriList.StringInput[UIStringJoin.LogoUrlLightBkgnd].StringValue = _currentRoom.LogoUrlLightBkgnd;
TriList.StringInput[UIStringJoin.LogoUrlLightBkgnd].StringValue = _CurrentRoom.LogoUrlDarkBkgnd; TriList.StringInput[UIStringJoin.LogoUrlLightBkgnd].StringValue = _currentRoom.LogoUrlDarkBkgnd;
} }
// Shutdown timer // Shutdown timer
_CurrentRoom.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted; _currentRoom.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted;
_CurrentRoom.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished; _currentRoom.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished;
_CurrentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; _currentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled;
// Link up all the change events from the room // Link up all the change events from the room
_CurrentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange; _currentRoom.OnFeedback.OutputChange += CurrentRoom_OnFeedback_OutputChange;
CurrentRoom_SyncOnFeedback(); CurrentRoom_SyncOnFeedback();
_CurrentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange; _currentRoom.IsWarmingUpFeedback.OutputChange += CurrentRoom_IsWarmingFeedback_OutputChange;
_CurrentRoom.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange; _currentRoom.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedback_OutputChange;
_CurrentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange; _currentRoom.CurrentVolumeDeviceChange += CurrentRoom_CurrentAudioDeviceChange;
RefreshAudioDeviceConnections(); RefreshAudioDeviceConnections();
_CurrentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange; _currentRoom.CurrentSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo(); RefreshSourceInfo();
(Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(this, CurrentRoom); var essentialsPanelMainInterfaceDriver = _parent as EssentialsPanelMainInterfaceDriver;
if (essentialsPanelMainInterfaceDriver != null)
{
essentialsPanelMainInterfaceDriver.HeaderDriver.SetupHeaderButtons(this, CurrentRoom);
}
} }
else else
{ {
@@ -838,7 +851,7 @@ namespace PepperDash.Essentials
void SetCurrentRoom(EssentialsHuddleSpaceRoom room) void SetCurrentRoom(EssentialsHuddleSpaceRoom room)
{ {
if (_CurrentRoom == room) return; if (_currentRoom == room) return;
// Disconnect current (probably never called) // Disconnect current (probably never called)
if (_CurrentRoom != null) if (_CurrentRoom != null)
@@ -885,7 +898,7 @@ namespace PepperDash.Essentials
/// <param name="e"></param> /// <param name="e"></param>
void room_ConfigChanged(object sender, EventArgs e) void room_ConfigChanged(object sender, EventArgs e)
{ {
RefreshCurrentRoom(_CurrentRoom); RefreshCurrentRoom(_currentRoom);
} }
/// <summary> /// <summary>
@@ -898,7 +911,7 @@ namespace PepperDash.Essentials
void CurrentRoom_SyncOnFeedback() void CurrentRoom_SyncOnFeedback()
{ {
var value = _CurrentRoom.OnFeedback.BoolValue; var value = _currentRoom.OnFeedback.BoolValue;
//Debug.Console(2, CurrentRoom, "UI: Is on event={0}", value); //Debug.Console(2, CurrentRoom, "UI: Is on event={0}", value);
TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value; TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value;
@@ -960,15 +973,14 @@ namespace PepperDash.Essentials
// Hide whatever is showing // Hide whatever is showing
if (IsVisible) if (IsVisible)
{ {
if (CurrentSourcePageManager != null) if (_currentSourcePageManager != null)
{ {
CurrentSourcePageManager.Hide(); _currentSourcePageManager.Hide();
CurrentSourcePageManager = null; _currentSourcePageManager = null;
} }
} }
if (previousInfo == null) return; var previousDev = previousInfo.SourceDevice;
var previousDev = previousInfo.SourceDevice;
// device type interfaces // device type interfaces
if (previousDev is ISetTopBoxControls) if (previousDev is ISetTopBoxControls)
@@ -999,7 +1011,7 @@ namespace PepperDash.Essentials
{ {
var routeInfo = CurrentRoom.CurrentSourceInfo; var routeInfo = CurrentRoom.CurrentSourceInfo;
// This will show off popup too // This will show off popup too
if (this.IsVisible) if (IsVisible)
ShowCurrentSource(); ShowCurrentSource();
if (routeInfo == null)// || !CurrentRoom.OnFeedback.BoolValue) if (routeInfo == null)// || !CurrentRoom.OnFeedback.BoolValue)
@@ -1007,22 +1019,23 @@ namespace PepperDash.Essentials
// Check for power off and insert "Room is off" // Check for power off and insert "Room is off"
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off"; TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "Room is off";
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power"; TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Power";
this.Hide(); Hide();
Parent.Show(); _parent.Show();
return; return;
} }
else if (CurrentRoom.CurrentSourceInfo != null)
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName;
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank"
}
else
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---";
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank";
}
// Connect controls if (CurrentRoom.CurrentSourceInfo != null)
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = routeInfo.PreferredName;
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = routeInfo.Icon; // defaults to "blank"
}
else
{
TriList.StringInput[UIStringJoin.CurrentSourceName].StringValue = "---";
TriList.StringInput[UIStringJoin.CurrentSourceIcon].StringValue = "Blank";
}
// Connect controls
if (routeInfo.SourceDevice != null) if (routeInfo.SourceDevice != null)
ConnectControlDeviceMethods(routeInfo.SourceDevice); ConnectControlDeviceMethods(routeInfo.SourceDevice);
} }