当前位置: 首页>>代码示例>>C#>>正文


C# TimerState类代码示例

本文整理汇总了C#中TimerState的典型用法代码示例。如果您正苦于以下问题:C# TimerState类的具体用法?C# TimerState怎么用?C# TimerState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TimerState类属于命名空间,在下文中一共展示了TimerState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Convert

 private Brush Convert(TimerState state)
 {
     Brush result = null;
     switch (state)
     {
         case TimerState.Ready:
             result = ReadyBrush;
             break;
         case TimerState.Sprint:
             result = SprintBrush;
             break;
         case TimerState.HomeStraight:
             result = HomeStraightBrush;
             break;
         case TimerState.Break:
             result = BreakBrush;
             break;
         case TimerState.BreakOverrun:
             result = BreanOverrunBrush;
             break;
         default:
             break;
     }
     return result;
 }
开发者ID:kewkie,项目名称:WorkBalance,代码行数:25,代码来源:TimerStateToBrushConverter.cs

示例2: buttonStart_Click

 private void buttonStart_Click(object sender, EventArgs e)
 {
     switch (this.timerState)
     {
         case TimerState.Stopped:
             this.elapsedTime = TimeSpan.FromSeconds(0);
             this.timer.Start();
             this.labelTime.Text = Config.GetTimeString(TimeSpan.FromSeconds(0));
             this.buttonStart.Text = @"Pause";
             this.timerState = TimerState.Started;
             this.buttonStop.Enabled = true;
             break;
         case TimerState.Started:
             this.timer.Stop();
             this.buttonStart.Text = @"Start";
             this.config.Save();
             this.timerState = TimerState.Paused;
             break;
         case TimerState.Paused:
             this.timer.Start();
             this.buttonStart.Text = @"Pause";
             this.timerState = TimerState.Started;
             break;
         default:
             break;
     }
 }
开发者ID:pongo,项目名称:uppTimer,代码行数:27,代码来源:Form1.cs

示例3: Stop

 public void Stop()
 {
     State = TimerState.Stopped;
     CurrentTime = TimeSpan.Zero;
     OnStopped();
     Stopped.Raise(this, EventArgs.Empty);
 }
开发者ID:gitter-badger,项目名称:MonoGame.Extended,代码行数:7,代码来源:GameTimer.cs

示例4: Timer

        public Timer()
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                m_SprintDuration = TimeSpan.FromSeconds(10);
                m_HomeStraightDuration = TimeSpan.FromSeconds(1);
                m_BreakDuration = TimeSpan.FromSeconds(5);
                m_MaxBreakDuration = TimeSpan.FromSeconds(10);
            }
            else
            {
                m_SprintDuration = TimeSpan.FromMinutes(25);
                m_HomeStraightDuration = TimeSpan.FromMinutes(1);
                m_BreakDuration = TimeSpan.FromMinutes(5);
                m_MaxBreakDuration = TimeSpan.FromMinutes(60);
            }

            m_InternalStates = new Dictionary<TimerState, ITimerState>();
            m_InternalStates.Add(TimerState.Ready, new ReadyTimerState(this));
            m_InternalStates.Add(TimerState.Sprint, new SprintTimerState(this));
            m_InternalStates.Add(TimerState.HomeStraight, new HomeStraightTimerState(this));
            m_InternalStates.Add(TimerState.Break, new BreakTimerState(this));
            m_InternalStates.Add(TimerState.BreakOverrun, new BreakOverrunTimerState(this));

            m_Timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) };
            m_Timer.Tick += (s, e) => m_InternalState.HandleSecondElapsed();

            _State = TimerState.Ready;
            m_InternalState = m_InternalStates[_State];
            m_InternalState.OnEnter();
        }
开发者ID:kewkie,项目名称:WorkBalance,代码行数:31,代码来源:Timer.cs

示例5: Start

 // Use this for initialization
 void Start()
 {
     actualTimeRemaining = 0f;
     minutesRemaining = 0;
     secondsRemaining = 0;
     timerState = TimerState.PAUSED;
     gameManagerScript = gameManagerObject.GetComponent<GameManager>();
 }
开发者ID:cpioli,项目名称:Ecovoi,代码行数:9,代码来源:TimerBehavior.cs

示例6: GetStateString

        public static string GetStateString(TimerState state)
        {
            var formatString = " ({0}{1})";
            var workOrBreak = state.ToString().Contains("Work") ? "work" : "break";
            var paused = state.ToString().Contains("Pause") ? " paused" : "";

            return string.Format(formatString, workOrBreak, paused);
        }
开发者ID:reliak,项目名称:reliak-timer,代码行数:8,代码来源:FormatHelper.cs

示例7: InvokeEventHandler

 internal static void InvokeEventHandler(EventHandler<TimerStateChangedEventArgs> handler, object sender, TimerState previousState, TimerState newState)
 {
     var snapshot = handler;
     if (snapshot != null)
     {
         snapshot.DynamicInvoke(sender, new TimerStateChangedEventArgs(previousState, newState));
     }
 }
开发者ID:kewkie,项目名称:WorkBalance,代码行数:8,代码来源:TimerStateChangedEventArgs.cs

示例8: Timer

 public Timer() {
     this.interval = 10;
     this.loop = true;
     this.showCountDown = true;
     this.onClientElapsed = "";
     this.finalSecondsBlink = false;
     this.finalSecondsThreshold = 0;
     this.timerState = TimerState.Started;
 }
开发者ID:katshann,项目名称:ogen,代码行数:9,代码来源:Timer.cs

示例9: PerformanceTimer

        public PerformanceTimer()
        {
            timerState = TimerState.Stopped;

            if (QueryPerformanceFrequency(ref tickFreq) == false)
            {
                throw new ApplicationException("Failed to query for the performance frequency!");
            }
        }
开发者ID:edwardsak,项目名称:homm,代码行数:9,代码来源:Timer.cs

示例10: Reset

        public void Reset()
        {
            // Stop tracking and reset time
            timer.Stop();
            TimerState = TimerState.Stopped;

            startTime = DateTime.Now;
            endTime = startTime;

            CalculateCurrentSpan(endTime, startTime);
        }
开发者ID:Blackjack92,项目名称:TimeManagement,代码行数:11,代码来源:TimerService.cs

示例11: SimpleScheduler

        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleScheduler"/> class.
        /// </summary>
        /// <param name="applicationMapPath">
        /// The application map path.
        /// </param>
        /// <param name="connection">
        /// The connection.
        /// </param>
        /// <param name="period">
        /// The period.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected SimpleScheduler(string applicationMapPath, IDbConnection connection, long period)
        {
            this.localSchDB = new SchedulerDB(connection, applicationMapPath);
            this.localPeriod = period;

            this.localTimerState = new TimerState();

            var t = new Timer(this.Schedule, this.localTimerState, Timeout.Infinite, Timeout.Infinite);

            this.localTimerState.Timer = t;
        }
开发者ID:divyang4481,项目名称:appleseedapp,代码行数:25,代码来源:SimpleScheduler.cs

示例12: Update

    // Update is called once per frame
    void Update()
    {
        if (state == TimerState.Started) {
            timeRemaining -= Time.deltaTime;
            timerLabel.text = string.Format("Time Remaining: {0}", Mathf.RoundToInt(timeRemaining));

            if (timeRemaining < 0f) {
                state = TimerState.Stopped;
                GameManager.Instance.OnOutOfTime();
            }
        }
    }
开发者ID:millwardesque,项目名称:FoodGun,代码行数:13,代码来源:UITimer.cs

示例13: Update

        public void Update(GameTime gameTime)
        {
            if(State!=TimerState.Running) return;

            CurrentTime += gameTime.ElapsedGameTime.TotalMilliseconds;
            if (CurrentTime >= TargetTime)
            {
                CurrentTime = 0;

                if (!Looping) State = TimerState.Finished;

                _callback();
            }
        }
开发者ID:GarethIW,项目名称:TimersAndTweens-XNA,代码行数:14,代码来源:Timer.cs

示例14: RedditAuth

 public RedditAuth(IWebAgent agent)
 {
     _uname = ConfigurationManager.AppSettings["BotUsername"];
     _pass = ConfigurationManager.AppSettings["BotPassword"];
     _clientId = ConfigurationManager.AppSettings["ClientID"];
     _clientSecret = ConfigurationManager.AppSettings["ClientSecret"];
     _redirectUri = ConfigurationManager.AppSettings["RedirectURI"];
     if ( string.IsNullOrEmpty( _uname ) ) throw new Exception( "Missing 'BotUsername' in config" );
     if ( string.IsNullOrEmpty( _pass ) ) throw new Exception( "Missing 'BotPassword' in config" );
     if ( string.IsNullOrEmpty( _clientId ) ) throw new Exception( "Missing 'ClientID' in config" );
     if ( string.IsNullOrEmpty( _clientSecret ) ) throw new Exception( "Missing 'ClientSecret' in config" );
     if ( string.IsNullOrEmpty( _redirectUri ) ) throw new Exception( "Missing 'RedirectURI' in config" );
     _webAgent = agent;
     _timerState = new TimerState();
 }
开发者ID:CrustyJew,项目名称:DirtBag,代码行数:15,代码来源:RedditAuth.cs

示例15: ChangeState

        public void ChangeState(TimerState state)
        {
            using (var session = DocumentStore.OpenSession())
            {
                session.Store(new StateChangedEvent
                {
                    Date = DateTimeOffset.Now,
                    OldState = CurrentState,
                    NewState = state
                });
                session.SaveChanges();
            }

            CurrentState = state;

            if (StateChanged != null)
            {
                StateChanged(state);
            }
        }
开发者ID:daniellangnet,项目名称:FocusMeter,代码行数:20,代码来源:StateManager.cs


注:本文中的TimerState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。