コード例 #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
ファイル: PulseGenerator.cs プロジェクト: perl-easj/OOProg
        /// <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
ファイル: Pulsator.cs プロジェクト: f-spot/f-spot-xplat
 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);
        }