Added countdown timer. Currently counts seconds from n to 0 with various events and callbacks

This commit is contained in:
Heath Volmer
2017-08-18 16:55:54 -06:00
parent 25122abed1
commit 4cda13f004
16 changed files with 194 additions and 13 deletions

View File

@@ -71,7 +71,19 @@ namespace PepperDash.Essentials
DeviceManager.ActivateAll();
Debug.Console(0, "Essentials load complete\r" +
"-------------------------------------------------------------");
}
//********************************************************************
#warning Remove these test things:
var cdt = new SecondsCountdownTimer("timer") { SecondsToCount = 20 };
cdt.CompletionAction = () => Debug.Console(0, "TIMER DONE FOOLS!");
cdt.IsRunningFeedback.OutputChange += (o, a) => Debug.Console(0, "TIMER Running={0}", cdt.IsRunningFeedback);
cdt.PercentFeedback.OutputChange += (o, a) => Debug.Console(0, "TIMER {0}%", cdt.PercentFeedback);
cdt.TimeRemainingFeedback.OutputChange += (o,a) => Debug.Console(0, "TIMER time: {0}", cdt.TimeRemainingFeedback);
DeviceManager.AddDevice(cdt);
//********************************************************************
}
catch (Exception e)
{
Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e);

View File

@@ -29,14 +29,34 @@ namespace PepperDash.Essentials
public BoolFeedback IsWarmingFeedback { get; private set; }
public BoolFeedback IsCoolingFeedback { get; private set; }
public BoolFeedback ShutdownPendingFeedback { get; private set; }
public BoolFeedback PowerOffPendingFeedback { get; private set; }
public IntFeedback PowerOffPendingTimerPercentFeedback { get; private set; }
public StringFeedback PowerOffPendingTimeStringFeedback { get; private set; }
bool _PowerOffPending;
public int PowerOffDelaySeconds { get; set; }
public BoolFeedback VacancyPowerDownFeedback { get; private set; }
protected abstract Func<bool> OnFeedbackFunc { get; }
public EssentialsRoomBase(string key, string name) : base(key, name)
{
OnFeedback = new BoolFeedback(OnFeedbackFunc);
PowerOffPendingFeedback = new BoolFeedback(() => _PowerOffPending);
}
/// <summary>
/// Triggers the shutdown timer
/// </summary>
public void StartShutdown()
{
if (!_PowerOffPending)
{
_PowerOffPending = true;
PowerOffPendingFeedback.FireUpdate();
}
}
}
}

View File

@@ -168,6 +168,8 @@ namespace PepperDash.Essentials
TriList.StringInput[UIStringJoin.StartActivityText].StringValue =
"Tap Share to begin";
TriList.BooleanInput[UIBoolJoin.LogoDefaultVisible].BoolValue = true;
}
/// <summary>

View File

@@ -319,19 +319,32 @@ namespace PepperDash.Essentials
/// 15061 Reveals the dual-display subpage
/// </summary>
public const uint DualDisplayPageVisible = 15061;
/// <summary>
/// 15062 Reveals the toggle switch for the sharing mode
/// </summary>
public const uint ToggleSharingModeVisible = 15062;
/// <summary>
/// 15063 Press for the toggle mode switch
/// </summary>
public const uint ToggleSharingModePress = 15063;
/// <summary>
/// 15064
/// </summary>
public const uint LogoDefaultVisible = 15064;
/// <summary>
/// 15065
/// </summary>
public const uint LogoUrlVisible = 15065;
/// <summary>
/// 15085 Visibility join for help subpage
/// </summary>
public const uint HelpPageVisible = 15085;
/// <summary>
/// 15086 Press for help header button
/// </summary>

View File

@@ -72,6 +72,11 @@ namespace PepperDash.Essentials
/// </summary>
public const uint HelpMessage = 3922;
/// <summary>
/// 3923
/// </summary>
public const uint LogoUrl = 3923;
/// <summary>
/// 3961 Name of source on display 1
/// </summary>