/// <summary> /// Start a "session" of event invocations. /// </summary> /// <param name="intervalInMilliSecs"> /// Interval (in milliseconds) between each event invocation. /// </param> /// <param name="noOfPulses"> /// Number of event invocations in this session /// </param> public async Task Start(int intervalInMilliSecs, int noOfPulses = 1000) { while (noOfPulses > 0) { await Task.Delay(intervalInMilliSecs); Pulse?.Invoke(); PulseWithCount?.Invoke(noOfPulses); noOfPulses--; } }
/// <summary> /// Start a "session" of Pulse events. /// </summary> /// <param name="intervalInMilliSecs"> /// Interval (in milliseconds) between each Pulse event /// </param> /// <param name="noOfPulses"> /// Number of Pulse events generated in this session /// </param> public async Task Start(int intervalInMilliSecs, int noOfPulses = 1000) { while (noOfPulses > 0) { await Task.Delay(intervalInMilliSecs); Pulse?.Invoke(); noOfPulses--; if (noOfPulses == 0) { LastPulse?.Invoke(); } } }
/// <summary> /// Start a "session" of Pulse events. /// </summary> /// <param name="intervalInMilliSecs"> /// Interval (in milliseconds) between each Pulse event /// </param> /// <param name="noOfPulses"> /// Number of Pulse events to be generated in this session /// </param> /// <returns></returns> public async Task Start(int intervalInMilliSecs, int noOfPulses = 1000) { int pulseCount = 0; while (noOfPulses > pulseCount) { await Task.Delay(intervalInMilliSecs); pulseCount++; Pulse?.Invoke(pulseCount); if (noOfPulses == pulseCount) { LastPulse?.Invoke(); } } }
protected virtual void OnPulse() { Pulse?.Invoke(this, EventArgs.Empty); }
public void OnPulse() { Pulse?.Invoke(); }
public void OnPulse() { UpdateToolbar(); UpdateStatusBar(); Pulse?.Invoke(this, EventArgs.Empty); }
public virtual void TriggerPulse() { var dt = DateTime.Now; // get common timestamp for all event handlers Pulse?.Invoke(dt); }