mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-24 09:54:58 +00:00
Improvements to CenRfgwController Addition of Button Extensions Addition of Hrxxx0WirelessRemoteController Addition of InfinetId to EssentialsControlPropertiesConfig Addition of CrestronRemotePropertiesConfig
47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using Crestron.SimplSharp;
|
|
using Crestron.SimplSharpPro;
|
|
using Crestron.SimplSharpPro.DeviceSupport;
|
|
|
|
using PepperDash.Core;
|
|
|
|
namespace PepperDash.Essentials.Core
|
|
{
|
|
public static class ButtonExtensions
|
|
{
|
|
public static Button SetButtonAction(this Button button, Action<bool> a)
|
|
{
|
|
button.UserObject = a;
|
|
return button;
|
|
}
|
|
|
|
public static Button SetButtonAction(this CrestronCollection<Button> bc, uint sigNum, Action<bool> a)
|
|
{
|
|
return bc[sigNum].SetButtonAction(a);
|
|
}
|
|
|
|
public static bool GetBool(this CrestronCollection<Button> bc, uint sigNum)
|
|
{
|
|
return bc[sigNum].State == eButtonState.Pressed ? true : false;
|
|
}
|
|
|
|
public static Button SetButtonPressedAction(this CrestronCollection<Button> bc, uint sigNum, Action a)
|
|
{
|
|
return bc[sigNum].SetButtonAction(b => { if (b) a(); });
|
|
}
|
|
|
|
public static Button SetButtonReleasedAction(this CrestronCollection<Button> bc, uint sigNum, Action a)
|
|
{
|
|
return bc[sigNum].SetButtonAction(b => { if (!b) a(); });
|
|
}
|
|
|
|
public static Button SetButtonFalseAction(this Button button, Action a)
|
|
{
|
|
return button.SetButtonAction(b => { if (!b) a(); });
|
|
}
|
|
}
|
|
} |