Пример #1
0
 /// <summary>
 /// UnitTimer.Tick事件调用的方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UnitCycleTimer_Tick(object sender, EventArgs e)
 {
     //为UnitTimerCycle()赋值
     Lights.LightsUp(chooseLightColor.SelectedIndex);
     UnitTimerCycle(Lights.textFontColor, Lights.rLColor, Lights.yLColor, Lights.gLColor);
     halfSencondTimerTb.Text = "unitTick次数:" + (++unitTimerCount) + ";";
 }
Пример #2
0
        //private void RestartTimer()
        //{
        //    Lights.StopTimer();
        //    ReInitializeParamThenRestart();
        //}
        /// <summary>
        /// 重启两个计时器(注意Timer.Start()的顺序)
        /// </summary>
        private void ReIniParamThenRestart()
        {
            //循环之初要处理的数据(MainTimer_Tick)
            IniPerLightRunTime(chooseLightColor.SelectedIndex);//交通灯 三个灯的倒计时时间
            Lights.IniParamsInMainTimer();
            Lights.IniLightsUpSequenceColor(chooseLightColor.SelectedIndex);

            //每个循环要做的事情(UnitTimer_Tick)
            Lights.LightsUp(chooseLightColor.SelectedIndex);
            countdownCurrenLightupTbk.Text       = Lights.countdownToUI.ToString();
            countdownLightsTbk.Text              = (Lights.trafficLightsTime2 + 1).ToString();
            countdownCurrenLightupTbk.Foreground = new SolidColorBrush(Lights.textFontColor);
            redLight.Fill    = new SolidColorBrush(Lights.rLColor);
            yellowLight.Fill = new SolidColorBrush(Lights.yLColor);
            greenLight.Fill  = new SolidColorBrush(Lights.gLColor);

            //启动计时器,第一个Tick发生在Interval时间之后
            Lights.ProceedTimer();
        }