mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
Added sig held helper function
This commit is contained in:
Binary file not shown.
@@ -2,6 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
|
||||||
@@ -59,6 +61,36 @@ namespace PepperDash.Essentials.Core
|
|||||||
return sig.SetBoolSigAction(b => { if (!b) a(); });
|
return sig.SetBoolSigAction(b => { if (!b) a(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tl"></param>
|
||||||
|
/// <param name="sigNum"></param>
|
||||||
|
/// <param name="heldAction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction)
|
||||||
|
{
|
||||||
|
CTimer heldTimer = null;
|
||||||
|
return tl.SetBoolSigAction(sigNum, press =>
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
// Hold action here
|
||||||
|
heldAction();
|
||||||
|
}, heldMs);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (heldTimer != null) // released
|
||||||
|
heldTimer.Stop();
|
||||||
|
// could also revise this else to fire a released action as well as cancel the timer
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -215,20 +215,11 @@ namespace PepperDash.Essentials
|
|||||||
//TriList.SetSigFalseAction(UIBoolJoin.RoomHeaderButtonPress, () =>
|
//TriList.SetSigFalseAction(UIBoolJoin.RoomHeaderButtonPress, () =>
|
||||||
// ShowInterlockedModal(UIBoolJoin.RoomHeaderPageVisible));
|
// ShowInterlockedModal(UIBoolJoin.RoomHeaderPageVisible));
|
||||||
|
|
||||||
#warning Add press and hold to gear button here
|
|
||||||
#warning CHANGE BACK THIS JOIN NUMBER to GearHeaderButtonPress!!!!!!
|
#warning CHANGE BACK THIS JOIN NUMBER to GearHeaderButtonPress!!!!!!
|
||||||
// Hold button
|
|
||||||
CTimer GearButtonHoldTimer = null;
|
TriList.SetSigHeldAction(UIBoolJoin.GearButtonVisible, 2000,
|
||||||
TriList.SetBoolSigAction(UIBoolJoin.GearButtonVisible, b => { //GearHeaderButtonPress
|
() => ShowInterlockedModal(UIBoolJoin.TechPanelSetupVisible));
|
||||||
if (b)
|
|
||||||
GearButtonHoldTimer = new CTimer(o =>
|
|
||||||
{
|
|
||||||
if (TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue) //GearHeaderButtonPress
|
|
||||||
ShowInterlockedModal(UIBoolJoin.TechPanelSetupVisible);
|
|
||||||
}, 2000);
|
|
||||||
else if (GearButtonHoldTimer != null)
|
|
||||||
GearButtonHoldTimer.Stop();
|
|
||||||
});
|
|
||||||
TriList.SetSigFalseAction(UIBoolJoin.TechPagesExitButton, () =>
|
TriList.SetSigFalseAction(UIBoolJoin.TechPagesExitButton, () =>
|
||||||
HideCurrentInterlockedModal());
|
HideCurrentInterlockedModal());
|
||||||
TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue = true;
|
TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue = true;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user