diff --git a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.projectinfo b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.projectinfo index 2093c161..621d120d 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/Timers/CountdownTimer.cs b/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs index 73d853e3..a8da97e4 100644 --- a/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs +++ b/Essentials Core/PepperDashEssentialsBase/Timers/CountdownTimer.cs @@ -10,6 +10,8 @@ namespace PepperDash.Essentials.Core { public class SecondsCountdownTimer: IKeyed { + public event EventHandler HasStarted; + public event EventHandler HasFinished; public event EventHandler WasCancelled; public string Key { get; private set; } @@ -74,28 +76,50 @@ namespace PepperDash.Essentials.Core _IsRunning = true; IsRunningFeedback.FireUpdate(); + var handler = HasStarted; + if (handler != null) + handler(this, new EventArgs()); } - public void Cancel() - { - Finish(); - var a = WasCancelled; - if (a != null) - a(this, new EventArgs()); - } - + /// + /// + /// public void Reset() { _IsRunning = false; Start(); } + /// + /// + /// + public void Cancel() + { + StopHelper(); + + var handler = WasCancelled; + if (handler != null) + handler(this, new EventArgs()); + } + + /// + /// Called upon expiration, or calling this will force timer to finish. + /// public void Finish() + { + StopHelper(); + + var handler = HasFinished; + if (handler != null) + handler(this, new EventArgs()); + } + + void StopHelper() { if (SecondTimer != null) SecondTimer.Stop(); _IsRunning = false; - IsRunningFeedback.FireUpdate(); + IsRunningFeedback.FireUpdate(); } void SecondElapsedTimerCallback(object o) diff --git a/Essentials DM/Essentials_DM/Essentials_DM.projectinfo b/Essentials DM/Essentials_DM/Essentials_DM.projectinfo index ef7cb61f..b7a387d9 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 d9acb686..5b7011bd 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/Config/ConfigReader.cs b/Essentials/PepperDashEssentials/Config/ConfigReader.cs index 75da2c2e..3d89bbaa 100644 --- a/Essentials/PepperDashEssentials/Config/ConfigReader.cs +++ b/Essentials/PepperDashEssentials/Config/ConfigReader.cs @@ -46,9 +46,9 @@ namespace PepperDash.Essentials { Debug.Console(0, "Config failed: \r{0}", e); } - } + static JObject MergeConfigs(JObject doubleConfig) { var system = JObject.FromObject(doubleConfig["system"]); diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo b/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo index 08391bf6..3e4e57b7 100644 Binary files a/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo and b/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo differ diff --git a/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs b/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs index b7c4093c..108d98fb 100644 --- a/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs +++ b/Essentials/PepperDashEssentials/Room/EssentialsRoomBase.cs @@ -30,11 +30,6 @@ namespace PepperDash.Essentials public BoolFeedback IsWarmingFeedback { get; private set; } public BoolFeedback IsCoolingFeedback { get; private set; } - //public BoolFeedback PowerOffPendingFeedback { get; private set; } - //bool _PowerOffPending; - //public IntFeedback PowerOffPendingTimerPercentFeedback { get; private set; } - //public StringFeedback PowerOffPendingTimeStringFeedback { get; private set; } - /// /// Timer used for informing the UIs of a shutdown /// @@ -68,6 +63,7 @@ namespace PepperDash.Essentials ShutdownPromptSeconds = 60; ShutdownVacancySeconds = 120; + ShutdownType = ShutdownType.None; OnFeedback = new BoolFeedback(OnFeedbackFunc); } @@ -105,4 +101,14 @@ namespace PepperDash.Essentials Manual, Vacancy } + + /// + /// + /// + public enum WarmingCoolingMode + { + None, + Warming, + Cooling + } } \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs index 5c1b9063..fe4e63fb 100644 --- a/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UI Drivers/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -151,6 +151,8 @@ namespace PepperDash.Essentials SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3); ActivityFooterSrl = new SubpageReferenceList(TriList, 15022, 3, 3, 3); + ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1); + SetupActivityFooterWhenRoomOff(); ShowVolumeGauge = true; @@ -350,7 +352,6 @@ namespace PepperDash.Essentials /// void ShareButtonPressed() { - ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1); if (!_CurrentRoom.OnFeedback.BoolValue) { ShareButtonSig.BoolValue = true; @@ -471,7 +472,8 @@ namespace PepperDash.Essentials /// public void PowerButtonPressed() { - if (!CurrentRoom.OnFeedback.BoolValue) + var room = CurrentRoom; + if (!room.OnFeedback.BoolValue || room.ShutdownPromptTimer.IsRunningFeedback.BoolValue) return; //EndMeetingButtonSig.BoolValue = true; @@ -512,36 +514,88 @@ namespace PepperDash.Essentials // Fire shutdown cancelled event? // - void Shutdown_IsRunningFeedback_OutputChange(object sender, EventArgs e) + //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. + // { + + // } + //} + + /// + /// + /// + /// + /// + void ShutdownPromptTimer_HasStarted(object sender, EventArgs e) { + // Do we need to check where the UI is? No? var timer = CurrentRoom.ShutdownPromptTimer; - if (timer.IsRunningFeedback.BoolValue) - { - EndMeetingButtonSig.BoolValue = true; - ShareButtonSig.BoolValue = false; + 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 + 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 + timer.Finish(); + }); } } + /// + /// + /// + /// + /// + void ShutdownPromptTimer_HasFinished(object sender, EventArgs e) + { + ShareButtonSig.BoolValue = true; // restore Share fb + EndMeetingButtonSig.BoolValue = false; + } + + /// + /// + /// + /// + /// + void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e) + { + EndMeetingButtonSig.BoolValue = false; + } + + /// + /// + /// void CancelPowerOffTimer() { if (PowerOffTimer != null) @@ -666,7 +720,10 @@ namespace PepperDash.Essentials TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name; // Shutdown timer - _CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.OutputChange += Shutdown_IsRunningFeedback_OutputChange; + //_CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.OutputChange += Shutdown_IsRunningFeedback_OutputChange; + _CurrentRoom.ShutdownPromptTimer.HasStarted += ShutdownPromptTimer_HasStarted; + _CurrentRoom.ShutdownPromptTimer.HasFinished += ShutdownPromptTimer_HasFinished; + _CurrentRoom.ShutdownPromptTimer.WasCancelled += ShutdownPromptTimer_WasCancelled; // Link up all the change events from the room _CurrentRoom.OnFeedback.OutputChange += _CurrentRoom_OnFeedback_OutputChange; diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index 1dccc6fa..bd09f955 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 634960f1..83b3e8e8 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ