TryGetEndTime() public method

Returns the end time for a timer started with this TimerStart at a specified time.
public TryGetEndTime ( System.DateTime startTime, System.DateTime &endTime ) : bool
startTime System.DateTime The time the timer is started.
endTime System.DateTime The end time for a timer started with this at the specified /// time if the end time could be computed, or otherwise.
return bool
Ejemplo n.º 1
0
        /// <summary>
        /// Starts the timer.
        /// </summary>
        /// <param name="newTimerStart">A <see cref="TimerStart"/>.</param>
        /// <returns>A value indicating whether the timer was started successfully.</returns>
        /// <exception cref="ObjectDisposedException">If the timer has been disposed.</exception>
        public bool Start(TimerStart newTimerStart)
        {
            this.ThrowIfDisposed();

            DateTime start = DateTime.Now;
            DateTime end;

            if (newTimerStart != null && newTimerStart.TryGetEndTime(start, out end))
            {
                this.timerStart = newTimerStart;
                this.OnPropertyChanged("TimerStart");

                this.Start(start, end);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the timer.
        /// </summary>
        /// <param name="newTimerStart">A <see cref="TimerStart"/>.</param>
        /// <returns>A value indicating whether the timer was started successfully.</returns>
        /// <exception cref="ObjectDisposedException">If the timer has been disposed.</exception>
        public bool Start(TimerStart newTimerStart)
        {
            this.ThrowIfDisposed();

            DateTime start = DateTime.Now;
            DateTime end;
            if (newTimerStart != null && newTimerStart.TryGetEndTime(start, out end))
            {
                this.timerStart = newTimerStart;
                this.OnPropertyChanged("TimerStart");

                this.Start(start, end);
                return true;
            }

            return false;
        }