Skip to content

Commit

Permalink
Add alternating False/True trigger to Metronome control.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueFinBima committed May 8, 2024
1 parent 95b6c88 commit bb75c35
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Helios/Controls/Special/Metronome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class Metronome : ImageDecorationBase, IWindowsPreviewInput
private HeliosValue _tickIntervalDefaultValue;
private HeliosValue _metronomeEnabledValue;
private HeliosTrigger _tickTrigger;
private HeliosTrigger _tickTockTrigger;
private bool _tickTock = false;
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();

public Metronome() : base("Metronome")
Expand All @@ -61,6 +63,8 @@ public Metronome() : base("Metronome")
Values.Add(_tickIntervalDefaultValue);
_tickTrigger = new HeliosTrigger(this, "", "", "Metronome Tick", "Fired when the time period interval expires.", "Always returns true.", BindingValueUnits.Boolean);
Triggers.Add(_tickTrigger);
_tickTockTrigger = new HeliosTrigger(this, "", "", "Metronome Tick Tock", "Fired when the time period interval expires.", "Returns alternating true and false.", BindingValueUnits.Boolean);
Triggers.Add(_tickTockTrigger);
}
#region Properties

Expand Down Expand Up @@ -180,6 +184,8 @@ private void TimerTick(object sender, EventArgs e)
{
TickInterval = _configuredTickInterval;
_tickTrigger.FireTrigger(new BindingValue(true));
_tickTock = !_tickTock;
_tickTockTrigger.FireTrigger(new BindingValue(_tickTock));
}

private void RestartTimer()
Expand Down

0 comments on commit bb75c35

Please sign in to comment.