diff --git a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.projectinfo b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.projectinfo index 621d120d..6d160f2d 100644 Binary files a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.projectinfo and b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.projectinfo differ diff --git a/Essentials Core/PepperDashEssentialsBase/Touchpanels/ModalDialog.cs b/Essentials Core/PepperDashEssentialsBase/Touchpanels/ModalDialog.cs index 02c4de8c..c704fa13 100644 --- a/Essentials Core/PepperDashEssentialsBase/Touchpanels/ModalDialog.cs +++ b/Essentials Core/PepperDashEssentialsBase/Touchpanels/ModalDialog.cs @@ -14,6 +14,10 @@ namespace PepperDash.Essentials.Core /// Bool press 3992 /// public const uint Button2Join = 3992; + /// + /// 3993 + /// + public const uint CancelButtonJoin = 3993; /// ///For visibility of single button. Bool feedback 3994 /// @@ -34,7 +38,7 @@ namespace PepperDash.Essentials.Core /// /// The seconds value of the countdown timer. Ushort join 3991 /// - public const uint TimerSecondsJoin = 3991; + //public const uint TimerSecondsJoin = 3991; /// /// The full ushort value of the countdown timer for a gauge. Ushort join 3992 /// @@ -73,7 +77,7 @@ namespace PepperDash.Essentials.Core BasicTriList TriList; Action ModalCompleteAction; - CTimer Timer; + //CTimer Timer; static object CompleteActionLock = new object(); @@ -85,8 +89,9 @@ namespace PepperDash.Essentials.Core { TriList = triList; // Attach actions to buttons - triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1, true)); - triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2, true)); + triList.SetSigFalseAction(Button1Join, () => OnModalComplete(1)); + triList.SetSigFalseAction(Button2Join, () => OnModalComplete(2)); + triList.SetSigFalseAction(CancelButtonJoin, () => CancelDialog()); } /// @@ -97,9 +102,9 @@ namespace PepperDash.Essentials.Core /// If the progress bar gauge needs to count down instead of up /// The action to run when the dialog is dismissed. Parameter will be 1 or 2 if button pressed, or 0 if dialog times out /// True when modal is created. - public bool PresentModalTimerDialog(uint numberOfButtons, string title, string iconName, + public bool PresentModalDialog(uint numberOfButtons, string title, string iconName, string message, string button1Text, - string button2Text, uint timeMs, bool decreasingGauge, Action completeAction) + string button2Text, bool showGauge, Action completeAction) { //Debug.Console(0, "Present dialog"); // Don't reset dialog if visible now @@ -131,66 +136,35 @@ namespace PepperDash.Essentials.Core TriList.StringInput[Button1TextJoin].StringValue = button1Text; TriList.StringInput[Button2TextJoin].StringValue = button2Text; } - // Show/hide timer - TriList.BooleanInput[TimerVisibleJoin].BoolValue = timeMs > 0; + // Show/hide guage + TriList.BooleanInput[TimerVisibleJoin].BoolValue = showGauge; //Reveal and activate TriList.BooleanInput[ModalVisibleJoin].BoolValue = true; - - // Start ramp timers if visible - if (timeMs > 0) - { - TriList.UShortInput[TimerSecondsJoin].UShortValue = (ushort)(timeMs / 1000); // Seconds display - TriList.UShortInput[TimerSecondsJoin].CreateRamp(0, (uint)(timeMs / 10)); - if (decreasingGauge) - { - // Gauge - TriList.UShortInput[TimerGaugeJoin].UShortValue = ushort.MaxValue; - // Text - TriList.UShortInput[TimerGaugeJoin].CreateRamp(0, (uint)(timeMs / 10)); - } - else - { - TriList.UShortInput[TimerGaugeJoin].UShortValue = 0; // Gauge - TriList.UShortInput[TimerGaugeJoin]. - CreateRamp(ushort.MaxValue, (uint)(timeMs / 10)); - } - Timer = new CTimer(o => OnModalComplete(0, false), timeMs); - } - - // Start a timer and fire action with no button on timeout. return true; } return false; } + /// + /// Hide dialog from elsewhere, fires no actions^ + /// public void CancelDialog() { - if (ModalIsVisible) - { - TriList.UShortInput[TimerSecondsJoin].StopRamp(); - TriList.UShortInput[TimerGaugeJoin].StopRamp(); - if (Timer != null) Timer.Stop(); - TriList.BooleanInput[ModalVisibleJoin].BoolValue = false; - } + OnModalComplete(0); } // When the modal is cleared or times out, clean up the various bits - void OnModalComplete(uint buttonNum, bool cancelled) + void OnModalComplete(uint buttonNum) { - //Debug.Console(2, "OnModalComplete {0}, {1}", buttonNum, cancelled); TriList.BooleanInput[ModalVisibleJoin].BoolValue = false; - if (cancelled) - { - TriList.UShortInput[TimerSecondsJoin].StopRamp(); - TriList.UShortInput[TimerGaugeJoin].StopRamp(); - Timer.Stop(); - } - if (ModalCompleteAction != null) + + var action = ModalCompleteAction; + if (action != null) { //Debug.Console(2, "Modal complete action"); - ModalCompleteAction(buttonNum); + action(buttonNum); } } } diff --git a/Essentials DM/Essentials_DM/Essentials_DM.projectinfo b/Essentials DM/Essentials_DM/Essentials_DM.projectinfo index b7a387d9..cf9b842f 100644 Binary files a/Essentials DM/Essentials_DM/Essentials_DM.projectinfo and b/Essentials DM/Essentials_DM/Essentials_DM.projectinfo differ diff --git a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.projectinfo b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.projectinfo index 5b7011bd..ec9dca11 100644 Binary files a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.projectinfo and b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.projectinfo differ diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo b/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo index 3e4e57b7..b6d90376 100644 Binary files a/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo and b/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo differ diff --git a/Essentials/PepperDashEssentials/Room/EssentialsHuddleSpaceRoom.cs b/Essentials/PepperDashEssentials/Room/EssentialsHuddleSpaceRoom.cs index e8b96659..4900992f 100644 --- a/Essentials/PepperDashEssentials/Room/EssentialsHuddleSpaceRoom.cs +++ b/Essentials/PepperDashEssentials/Room/EssentialsHuddleSpaceRoom.cs @@ -149,7 +149,7 @@ namespace PepperDash.Essentials /// public override void Shutdown() { - RunRouteAction("roomoff"); + RunRouteAction("roomOff"); } /// @@ -261,8 +261,6 @@ namespace PepperDash.Essentials if (successCallback != null) successCallback(); -#warning Need to again handle special commands in here. - }, 0); // end of CTimer } diff --git a/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs b/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs index 108d98fb..94ddd749 100644 --- a/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs +++ b/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs @@ -60,6 +60,7 @@ namespace PepperDash.Essentials if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue) ShutdownType = ShutdownType.None; }; + ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered ShutdownPromptSeconds = 60; ShutdownVacancySeconds = 120; diff --git a/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs index fe4e63fb..093720df 100644 --- a/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -476,74 +476,9 @@ namespace PepperDash.Essentials if (!room.OnFeedback.BoolValue || room.ShutdownPromptTimer.IsRunningFeedback.BoolValue) return; - //EndMeetingButtonSig.BoolValue = true; - //ShareButtonSig.BoolValue = false; - CurrentRoom.StartShutdown(ShutdownType.Manual); - - //// Timeout or button 1 press will shut down - //var modal = new ModalDialog(TriList); - //uint time = 60000; - //uint seconds = time / 1000; - //var message = string.Format("Meeting will end in {0} seconds", seconds); - //modal.PresentModalTimerDialog(2, "End Meeting", "Power", message, - // "End Meeting Now", "Cancel", time, true, - // but => - // { - // if (but != 2) - // CurrentRoom.RunRouteAction("roomOff"); - // else - // ShareButtonSig.BoolValue = true; // restore Share fb - // EndMeetingButtonSig.BoolValue = false; - // }); } -#warning WHAT I'M TRYING TO DO WITH SHUTDOWN PROMPTS. SEE COMMENT - // UI should ask room to shutdown - // UI should be attached to room's shutdown timer - // When timer starts, the UI should present a corresponding modal, with the right text - // the modal bar will decrement depending on the timer's percent - // If the user selects "end now" - // Cancel the modal - // Call shutdown on the room (which should cancel any timers) - // Room cancels timer - // Room fires Shutdown event? - // If the UI cancels shutdown - // Call cancel shutdown on room - // Timer will go low - // Fire shutdown cancelled event? - // - - //void Shutdown_IsRunningFeedback_OutputChange(object sender, EventArgs e) - //{ - // var timer = CurrentRoom.ShutdownPromptTimer; - // if (timer.IsRunningFeedback.BoolValue) - // { - // EndMeetingButtonSig.BoolValue = true; - // ShareButtonSig.BoolValue = false; - - // if (CurrentRoom.ShutdownType == ShutdownType.Manual) - // { - // var modal = new ModalDialog(TriList); - // var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds); - // modal.PresentModalTimerDialog(2, "End Meeting", "Power", message, - // "End Meeting Now", "Cancel", 0, true, - // but => - // { - // if (but != 2) // any button except for End cancels - // timer.Cancel(); - // else - // ShareButtonSig.BoolValue = true; // restore Share fb - // EndMeetingButtonSig.BoolValue = false; - // }); - // } - // } - // else // Timer stopped. - // { - - // } - //} - /// /// /// @@ -560,8 +495,7 @@ namespace PepperDash.Essentials { var modal = new ModalDialog(TriList); var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds); - modal.PresentModalTimerDialog(2, "End Meeting", "Power", message, - "End Meeting Now", "Cancel", 0, true, + modal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, but => { if (but != 2) // any button except for End cancels diff --git a/Essentials/PepperDashEssentials/UI Drivers/EssentialsPresentationPanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UI Drivers/EssentialsPresentationPanelAvFunctionsDriver.cs index 087a4efe..7f4d0029 100644 --- a/Essentials/PepperDashEssentials/UI Drivers/EssentialsPresentationPanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UI Drivers/EssentialsPresentationPanelAvFunctionsDriver.cs @@ -654,8 +654,8 @@ namespace PepperDash.Essentials uint time = 60000; uint seconds = time / 1000; var message = string.Format("Meeting will end in {0} seconds", seconds); - modal.PresentModalTimerDialog(2, "End Meeting", "Power", message, - "End Meeting Now", "Cancel", time, true, + modal.PresentModalDialog(2, "End Meeting", "Power", message, + "End Meeting Now", "Cancel", true, but => { EndMeetingButtonSig.BoolValue = false; diff --git a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index 015632ad..89e5ea2d 100644 --- a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -175,6 +175,32 @@ namespace PepperDash.Essentials } } + public void PulseBool(uint join) + { + var act = Panel.BooleanInput[join].UserObject as Action; + if (act != null) + { + act(true); + act(false); + } + } + + public void SetBoolSig(uint join, bool value) + { + var act = Panel.BooleanInput[join].UserObject as Action; + if (act != null) + act(value); + } + + public void SetIntSig(uint join, ushort value) + { + var act = Panel.BooleanInput[join].UserObject as Action; + if (act != null) + { + act(value); + } + } + void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) { if (Debug.Level == 2) diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index bd09f955..8c91ecc3 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 83b3e8e8..f414a860 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ