mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-17 05:35:03 +00:00
fix: better implmentation of input select
This commit is contained in:
@@ -121,7 +121,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
// Fake cool-down cycle
|
// Fake cool-down cycle
|
||||||
CooldownTimer = new CTimer(o =>
|
CooldownTimer = new CTimer(o =>
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Cooldown timer ending");
|
Debug.LogMessage(LogEventLevel.Verbose, "Cooldown timer ending", this);
|
||||||
_IsCoolingDown = false;
|
_IsCoolingDown = false;
|
||||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||||
_PowerIsOn = false;
|
_PowerIsOn = false;
|
||||||
@@ -142,10 +142,10 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, this, "ExecuteSwitch: {0}", selector);
|
Debug.LogMessage(LogEventLevel.Verbose, this, "ExecuteSwitch: {0}", selector);
|
||||||
|
|
||||||
if (!_PowerIsOn)
|
if (!_PowerIsOn)
|
||||||
{
|
{
|
||||||
PowerOn();
|
PowerOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Inputs.Items.TryGetValue(selector.ToString(), out var input))
|
if (!Inputs.Items.TryGetValue(selector.ToString(), out var input))
|
||||||
return;
|
return;
|
||||||
@@ -153,32 +153,6 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
input.Select();
|
input.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetInput(string selector)
|
|
||||||
{
|
|
||||||
ISelectableItem currentInput = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
currentInput = Inputs.Items.SingleOrDefault(Inputs => Inputs.Value.IsSelected).Value;
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
|
|
||||||
|
|
||||||
if (currentInput != null)
|
|
||||||
{
|
|
||||||
Debug.LogMessage(LogEventLevel.Verbose, this, "SetInput: {0}", selector);
|
|
||||||
currentInput.IsSelected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Inputs.Items.TryGetValue(selector, out var input))
|
|
||||||
return;
|
|
||||||
|
|
||||||
input.IsSelected = true;
|
|
||||||
|
|
||||||
Inputs.CurrentItem = selector;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region IBasicVolumeWithFeedback Members
|
#region IBasicVolumeWithFeedback Members
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,12 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
|||||||
|
|
||||||
public void Select()
|
public void Select()
|
||||||
{
|
{
|
||||||
_parent.SetInput(Key);
|
if (!_parent.PowerIsOnFeedback.BoolValue) _parent.PowerOn();
|
||||||
|
|
||||||
|
foreach(var input in _parent.Inputs.Items)
|
||||||
|
{
|
||||||
|
input.Value.IsSelected = input.Key == this.Key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user