Try catch on some Fusion usage bugs; Fixed press-hold on TriListExtensions

This commit is contained in:
Heath Volmer
2017-08-24 20:29:30 -06:00
parent 12d9ad1183
commit 0d42a41af3
8 changed files with 18 additions and 18 deletions

View File

@@ -71,7 +71,7 @@ namespace PepperDash.Essentials.Core
if (handler != null) if (handler != null)
{ {
Debug.Console(1, "Device Usage Ended at {1}. In use for {2} minutes.", UsageEndTime, timeUsed.Minutes); Debug.Console(1, "Device Usage Ended at {0}. In use for {1} minutes.", UsageEndTime, timeUsed.Minutes);
handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes }); handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
} }
} }

View File

@@ -7,6 +7,8 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
@@ -75,11 +77,12 @@ namespace PepperDash.Essentials.Core
{ {
if (press) if (press)
{ {
// Could insert a pressed action here // Could insert a pressed action here
heldTimer = new CTimer(o => heldTimer = new CTimer(o =>
{ {
// if still held and there's an action // if still held and there's an action
if (tl.BooleanInput[sigNum].BoolValue && heldAction != null) if (tl.BooleanOutput[sigNum].BoolValue && heldAction != null)
// Hold action here // Hold action here
heldAction(); heldAction();
}, heldMs); }, heldMs);

View File

@@ -242,7 +242,8 @@ namespace PepperDash.Essentials.Devices.Displays
CrestronInvoke.BeginInvoke(o => CrestronInvoke.BeginInvoke(o =>
{ {
CrestronEnvironment.Sleep(2500); CrestronEnvironment.Sleep(2500);
Debug.Console(2, this, "*#* NEW POWER STATE AFTER PAUSE={0} CURRENT={1}", _PowerValueIncomingWaitingForCheck, _PowerIsOn); Debug.Console(2, this, "*#* NEW POWER STATE AFTER PAUSE={0} CURRENT={1}",
_PowerValueIncomingWaitingForCheck, _PowerIsOn);
if (_PowerValueIncomingWaitingForCheck != _PowerIsOn) if (_PowerValueIncomingWaitingForCheck != _PowerIsOn)
{ {
_PowerIsOn = _PowerValueIncomingWaitingForCheck; _PowerIsOn = _PowerValueIncomingWaitingForCheck;

View File

@@ -66,18 +66,6 @@ namespace PepperDash.Essentials
DeviceManager.ActivateAll(); DeviceManager.ActivateAll();
Debug.Console(0, "Essentials load complete\r" + Debug.Console(0, "Essentials load complete\r" +
"-------------------------------------------------------------"); "-------------------------------------------------------------");
//********************************************************************
#warning Remove these test things:
var cdt = new SecondsCountdownTimer("timer") { SecondsToCount = 20 };
cdt.WasCancelled += (o,a) => Debug.Console(0, "TIMER CANCELLED 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) catch (Exception e)
{ {

View File

@@ -246,8 +246,16 @@ namespace PepperDash.Essentials
{ {
var lastSource = dict[LastSourceKey].SourceDevice; var lastSource = dict[LastSourceKey].SourceDevice;
try
{
if (lastSource != null && lastSource is IUsageTracking) if (lastSource != null && lastSource is IUsageTracking)
(lastSource as IUsageTracking).UsageTracker.EndDeviceUsage(); (lastSource as IUsageTracking).UsageTracker.EndDeviceUsage();
}
catch (Exception e)
{
Debug.Console(1, this, "EXCEPTION in end usage tracking (257):\r{0}", e);
}
} }
// Let's run it // Let's run it