コード例 #1
0
ファイル: Timer.cs プロジェクト: lilbro1062000/Hourglass
        /// <summary>
        /// Initializes a new instance of the <see cref="Timer"/> class.
        /// </summary>
        /// <param name="timerInfo">A <see cref="TimerInfo"/> representing the state of the <see
        /// cref="Timer"/>.</param>
        public Timer(TimerInfo timerInfo)
            : base(timerInfo)
        {
            this.timerStart = TimerStart.FromTimerStartInfo(timerInfo.TimerStart);
            this.options = TimerOptions.FromTimerOptionsInfo(timerInfo.Options) ?? new TimerOptions();

            this.UpdateHourglassTimer();
        }
コード例 #2
0
ファイル: Timer.cs プロジェクト: lilbro1062000/Hourglass
        /// <summary>
        /// Returns a <see cref="Timer"/> for a <see cref="TimerInfo"/>.
        /// </summary>
        /// <param name="timerInfo">A <see cref="TimerInfo"/>.</param>
        /// <returns>The <see cref="Timer"/> for the <see cref="TimerInfo"/>.</returns>
        public static Timer FromTimerInfo(TimerInfo timerInfo)
        {
            if (timerInfo == null)
            {
                return null;
            }

            return new Timer(timerInfo);
        }
コード例 #3
0
ファイル: TimerBase.cs プロジェクト: ZhuXiaomin/Hourglass
        /// <summary>
        /// Initializes a new instance of the <see cref="TimerBase"/> class.
        /// </summary>
        /// <param name="timerInfo">A <see cref="TimerInfo"/> representing the state of the <see cref="TimerBase"/>.</param>
        protected TimerBase(TimerInfo timerInfo)
            : this()
        {
            this.state = timerInfo.State;
            this.startTime = timerInfo.StartTime;
            this.endTime = timerInfo.EndTime;
            this.timeElapsed = timerInfo.TimeElapsed;
            this.timeLeft = timerInfo.TimeLeft;
            this.timeExpired = timerInfo.TimeExpired;
            this.totalTime = timerInfo.TotalTime;

            if (this.state == TimerState.Running)
            {
                this.dispatcherTimer.Start();
            }
        }