private void OnTick(TimeCounter timer) { if (!m_triggered) { if (m_interval < timer.Time) { m_triggered = true; Triggered(); } } else { if (m_interval > timer.Time) { m_triggered = false; } } }
private void AttachTimer(TimeCounter timer) { timer.Tick += OnTick; }
private void DetachTimer(TimeCounter timer) { timer.Tick -= OnTick; }
/// <summary> /// Constructs the trigger. /// </summary> /// <param name="interval">A time interval</param> /// <param name="timer">A timer to be attached.</param> public TimeIntervalTrigger(TimeSpan interval, TimeCounter timer) : this(interval) { Timer = timer; }