示例#1
0
        /// <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--;
            }
        }
示例#2
0
        /// <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();
                }
            }
        }
示例#3
0
        /// <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();
                }
            }
        }
示例#4
0
 protected virtual void OnPulse()
 {
     Pulse?.Invoke(this, EventArgs.Empty);
 }
示例#5
0
 public void OnPulse()
 {
     Pulse?.Invoke();
 }
示例#6
0
 public void OnPulse()
 {
     UpdateToolbar();
     UpdateStatusBar();
     Pulse?.Invoke(this, EventArgs.Empty);
 }
示例#7
0
        public virtual void TriggerPulse()
        {
            var dt = DateTime.Now; // get common timestamp for all event handlers

            Pulse?.Invoke(dt);
        }