mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-13 11:44:54 +00:00
Try catch on some Fusion usage bugs; Fixed press-hold on TriListExtensions
This commit is contained in:
@@ -71,7 +71,7 @@ namespace PepperDash.Essentials.Core
|
||||
|
||||
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 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
|
||||
using PepperDash.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
@@ -75,11 +77,12 @@ namespace PepperDash.Essentials.Core
|
||||
{
|
||||
if (press)
|
||||
{
|
||||
|
||||
// Could insert a pressed action here
|
||||
heldTimer = new CTimer(o =>
|
||||
{
|
||||
// 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
|
||||
heldAction();
|
||||
}, heldMs);
|
||||
|
||||
@@ -242,7 +242,8 @@ namespace PepperDash.Essentials.Devices.Displays
|
||||
CrestronInvoke.BeginInvoke(o =>
|
||||
{
|
||||
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)
|
||||
{
|
||||
_PowerIsOn = _PowerValueIncomingWaitingForCheck;
|
||||
|
||||
@@ -66,18 +66,6 @@ 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.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)
|
||||
{
|
||||
|
||||
@@ -880,7 +880,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void UsageTracker_DeviceUsageEnded(object sender, DeviceUsageEventArgs e)
|
||||
{
|
||||
{
|
||||
var device = sender as Device;
|
||||
|
||||
var configDevice = ConfigReader.ConfigObject.Devices.Where(d => d.Key.Equals(device.Key));
|
||||
|
||||
@@ -246,8 +246,16 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
var lastSource = dict[LastSourceKey].SourceDevice;
|
||||
|
||||
if (lastSource != null && lastSource is IUsageTracking)
|
||||
(lastSource as IUsageTracking).UsageTracker.EndDeviceUsage();
|
||||
try
|
||||
{
|
||||
if (lastSource != null && lastSource is IUsageTracking)
|
||||
(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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user