Working on adding shutdown timing to room, not UI

This commit is contained in:
Heath Volmer
2017-08-19 11:41:30 -06:00
parent 4cda13f004
commit 0becff5320
9 changed files with 177 additions and 47 deletions

View File

@@ -473,25 +473,75 @@ namespace PepperDash.Essentials
{
if (!CurrentRoom.OnFeedback.BoolValue)
return;
EndMeetingButtonSig.BoolValue = true;
ShareButtonSig.BoolValue = false;
// 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;
});
//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
{
}
}
void CancelPowerOffTimer()
{
if (PowerOffTimer != null)
@@ -615,6 +665,9 @@ namespace PepperDash.Essentials
TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = _CurrentRoom.Name;
// Shutdown timer
_CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.OutputChange += Shutdown_IsRunningFeedback_OutputChange;
// Link up all the change events from the room
_CurrentRoom.OnFeedback.OutputChange += _CurrentRoom_OnFeedback_OutputChange;
_CurrentRoom.CurrentVolumeDeviceChange += _CurrentRoom_CurrentAudioDeviceChange;