/// <summary> /// NoChanges则继续,HaveChangd则重新计时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SetLightTimeBtn_Click(object sender, RoutedEventArgs e) { //WrtLightCd(string rCount, string yCount, string gCount) tempTextRedAfter = Lights.FetchNum(redCount.Text).ToString(); tempTextYellowAfter = Lights.FetchNum(yellowCount.Text).ToString(); tempTextGreenAfter = Lights.FetchNum(greenCount.Text).ToString(); bool redCountChanged = Lights.IsTextChanged(tempTextRedBefore, tempTextRedAfter); bool yellowCountChangded = Lights.IsTextChanged(tempTextYellowBefore, tempTextYellowAfter); bool greenCountChanged = Lights.IsTextChanged(tempTextGreenBefore, tempTextGreenAfter); //把更改后的内容保存到App.config中 string rCount = Lights.IsValueChanged(redCountChanged, tempTextRedAfter); string yCount = Lights.IsValueChanged(yellowCountChangded, tempTextYellowAfter); string gCount = Lights.IsValueChanged(greenCountChanged, tempTextGreenAfter); Lights.WrtLightCd(rCount, yCount, gCount); if (redCountChanged || yellowCountChangded || greenCountChanged) { Lights.StopTimer(); ReIniParamThenRestart(); } else { Lights.ProceedTimer(); } SetLightTimeBtn.Foreground = new SolidColorBrush(Lights.Green); }
private void chooseLightColor_SelectionChanged(object sender, SelectionChangedEventArgs e) { Lights.StopTimer(); ComboBoxItem cbItem = sender as ComboBoxItem; if (cbItem != null) { LightsColor(cbItem.Content.ToString());//设置灯和文本的颜色 } if (!firstClick) { ReIniParamThenRestart(); } }
private void AddTimeBtn_Click(object sender, RoutedEventArgs e) { Lights.StopTimer(); int addTime; //没有不能转换为数字、输入数值大小等问题 if (AddTimeTbx.Text == null) { addTime = 0; } else { addTime = Convert.ToInt32(AddTimeTbx.Text); } Lights.GetAddTimeParamsValue(addTime); SetXStatusLables(); }
private void btnDisableTimer_Click(object sender, RoutedEventArgs e) { Lights.StopTimer(); }