Meetings list on-screen with Mock VC

This commit is contained in:
Heath Volmer
2017-10-03 14:47:37 -06:00
parent db4b5e863b
commit c53a14f05e
9 changed files with 99 additions and 54 deletions

View File

@@ -73,6 +73,40 @@ namespace PepperDash.Essentials.Core
return SetSigHeldAction(tl, sigNum, heldMs, heldAction, null);
}
/// <summary>
/// Sets an action to a held sig as well as a released-without-hold action
/// </summary>
/// <returns></returns>
public static BoolOutputSig SetSigHeldAction(this BoolOutputSig sig, uint heldMs, Action heldAction, Action releaseAction)
{
CTimer heldTimer = null;
bool wasHeld = false;
return sig.SetBoolSigAction(press =>
{
if (press)
{
wasHeld = false;
// Could insert a pressed action here
heldTimer = new CTimer(o =>
{
// if still held and there's an action
if (sig.BoolValue && heldAction != null)
{
wasHeld = true;
// Hold action here
heldAction();
}
}, heldMs);
}
else if (!wasHeld) // released
{
heldTimer.Stop();
if (releaseAction != null)
releaseAction();
}
});
}
/// <summary>
/// Sets an action to a held sig as well as a released-without-hold action
@@ -80,35 +114,9 @@ namespace PepperDash.Essentials.Core
/// <returns>The sig</returns>
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction)
{
CTimer heldTimer = null;
bool wasHeld = false;
return tl.SetBoolSigAction(sigNum, press =>
{
if (press)
{
wasHeld = false;
// Could insert a pressed action here
heldTimer = new CTimer(o =>
{
// if still held and there's an action
if (tl.BooleanOutput[sigNum].BoolValue && heldAction != null)
{
wasHeld = true;
// Hold action here
heldAction();
}
}, heldMs);
}
else if(!wasHeld) // released
{
heldTimer.Stop();
if (releaseAction != null)
releaseAction();
}
});
return tl.BooleanOutput[sigNum].SetSigHeldAction(heldMs, heldAction, releaseAction);
}
/// <summary>
///
/// </summary>

View File

@@ -44,15 +44,8 @@ namespace PepperDash.Essentials.Devices.Common.Codec
{
get
{
var timeToMeetingStart = StartTime - DateTime.Now;
var timetoMeetingEnd = DateTime.Now - EndTime;
// Meeting is joinable from 5 minutes before start until 5 minutes before end
if (timeToMeetingStart.Minutes <= 5 && timetoMeetingEnd.Minutes >= 5)
return true;
else
return false;
return StartTime.AddMinutes(-5) <= DateTime.Now
&& DateTime.Now <= EndTime.AddMinutes(-5);
}
}
public string ConferenceNumberToDial { get; set; }

View File

@@ -333,8 +333,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
for(int i = 0; i < 5; i++)
{
var m = new Meeting();
m.StartTime = DateTime.Now.AddHours(1 + i);
m.EndTime = DateTime.Now.AddHours(1 + i).AddMinutes(30);
m.StartTime = DateTime.Now.AddMinutes(3).AddHours(i);
m.EndTime = DateTime.Now.AddHours(i).AddMinutes(30);
m.Title = "Meeting " + i;
m.ConferenceNumberToDial = i + "meeting@fake.com";
sch.Meetings.Add(m);

View File

@@ -517,6 +517,10 @@ namespace PepperDash.Essentials
/// 15045 - Visibility for the bar containing call navigation button list
/// </summary>
public const uint CallStagingBarVisible = 15045;
/// <summary>
/// 15046
/// </summary>
public const uint MeetingsListVisible = 15046;
/// <summary>
/// 15051
/// </summary>

View File

@@ -61,5 +61,9 @@
/// 15022 The main activity footer
/// </summary>
public const uint ActivityFooterSRL = 15022;
/// <summary>
/// 15023 - The header meetings SRL
/// </summary>
public const uint MeetingListSRL = 15023;
}
}

View File

@@ -25,7 +25,7 @@ namespace PepperDash.Essentials
{
public BoolInputSig SelectedSig { get; private set; }
public BoolInputSig VisibleSig { get; private set; }
BoolOutputSig OutputSig;
public BoolOutputSig OutputSig { get; private set; }
StringInputSig IconSig;
public HeaderListButton(SmartObjectHeaderButtonList list, uint index)
@@ -37,11 +37,6 @@ namespace PepperDash.Essentials
IconSig = so.StringInput["Set Item " + index + " Icon Serial"];
}
public void SetBoolFalseAction(Action a)
{
OutputSig.SetSigFalseAction(a);
}
public void SetIcon(string i)
{
IconSig.StringValue = i;

View File

@@ -10,6 +10,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects;
using PepperDash.Essentials.Core.PageManagers;
using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials
{
@@ -85,6 +86,11 @@ namespace PepperDash.Essentials
/// </summary>
SubpageReferenceList ActivityFooterSrl;
/// <summary>
///
/// </summary>
SubpageReferenceList MeetingsSrl;
/// <summary>
/// The list of buttons on the header. Managed with visibility only
/// </summary>
@@ -188,6 +194,9 @@ namespace PepperDash.Essentials
ShareButtonSig = ActivityFooterSrl.BoolInputSig(1, 1);
EndMeetingButtonSig = ActivityFooterSrl.BoolInputSig(3, 1);
MeetingsSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.MeetingListSRL, 3, 3, 5);
// buttons are added in SetCurrentRoom
HeaderButtonsList = new SmartObjectHeaderButtonList(TriList.SmartObjects[UISmartObjectJoin.HeaderButtonList]);
@@ -408,6 +417,15 @@ namespace PepperDash.Essentials
}
}
/// <summary>
/// Calendar should only be visible when it's supposed to
/// </summary>
void CalendarPress()
{
RefreshMeetingsList();
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsListVisible);
}
/// <summary>
/// Reveals the tech page and puts away anything that's in the way.
/// </summary>
@@ -803,12 +821,9 @@ namespace PepperDash.Essentials
//
var setupButton = new HeaderListButton(HeaderButtonsList, 5);
setupButton.SetIcon(HeaderListButton.Gear);
setupButton.SetBoolFalseAction(() => PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible));
#warning Add held action - and add press/hold to SIG helper
//// Setup button - shows volumes with default button OR hold for tech page
//TriList.SetSigHeldAction(UIBoolJoin.HeaderGearButtonPress, 2000,
// ShowTech,
// () => PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible));
setupButton.OutputSig.SetSigHeldAction(2000,
ShowTech,
() => PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible));
TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
PopupInterlock.HideAndClear());
@@ -833,7 +848,7 @@ namespace PepperDash.Essentials
}
var helpButton = new HeaderListButton(HeaderButtonsList, 4);
helpButton.SetIcon(HeaderListButton.Help);
helpButton.SetBoolFalseAction(() =>
helpButton.OutputSig.SetSigFalseAction(() =>
{
string message = null;
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
@@ -859,14 +874,14 @@ namespace PepperDash.Essentials
{
var calBut = new HeaderListButton(HeaderButtonsList, nextIndex);
calBut.SetIcon(HeaderListButton.Calendar);
calBut.SetBoolFalseAction(() => { });
calBut.OutputSig.SetSigFalseAction(CalendarPress);
nextIndex--;
}
// Call button
var callBut = new HeaderListButton(HeaderButtonsList, nextIndex);
callBut.SetIcon(HeaderListButton.OnHook);
callBut.SetBoolFalseAction(() =>
callBut.OutputSig.SetSigFalseAction(() =>
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HeaderActiveCallsListVisible));
nextIndex--;
@@ -875,10 +890,36 @@ namespace PepperDash.Essentials
{
var blankBut = new HeaderListButton(HeaderButtonsList, i);
blankBut.ClearIcon();
blankBut.SetBoolFalseAction(() => { });
blankBut.OutputSig.SetSigFalseAction(() => { });
}
}
/// <summary>
///
/// </summary>
void RefreshMeetingsList()
{
ushort i = 0;
foreach (var m in CurrentRoom.ScheduleSource.CodecSchedule.Meetings)
{
i++;
MeetingsSrl.StringInputSig(i, 1).StringValue = m.StartTime.ToShortTimeString();
MeetingsSrl.StringInputSig(i, 2).StringValue = m.EndTime.ToShortTimeString();
MeetingsSrl.StringInputSig(i, 3).StringValue = m.Title;
MeetingsSrl.StringInputSig(i, 4).StringValue = "Join";
MeetingsSrl.BoolInputSig(i, 2).BoolValue = m.Joinable;
var mm = m; // lambda scope
MeetingsSrl.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() =>
{
PopupInterlock.Hide();
var d = CurrentRoom.ScheduleSource as VideoCodecBase;
if (d != null)
d.Dial(mm.ConferenceNumberToDial);
});
}
MeetingsSrl.Count = i;
}
/// <summary>
/// For room on/off changes
/// </summary>