/* * */ private void Test_Click(object sender, RoutedEventArgs e) { Button tmp = sender as Button; _CalPartNo = byte.Parse(tmp.Tag.ToString()); CalibrateType cltype = (CalibrateType)int.Parse(tmp.Tag.ToString()); this.tb_title.Text = cltype.ToString(); switch (cltype) { case CalibrateType.CAL_HOT: case CalibrateType.CAL_HOT_BREW: case CalibrateType.CAL_HOT_MIX_ONE: case CalibrateType.CAL_HOT_MIX_TWO: case CalibrateType.CAL_CANISTER_ONE: case CalibrateType.CAL_CANISTER_TWO: case CalibrateType.CAL_CANISTER_THREE: case CalibrateType.CAL_CANISTER_FOUR: case CalibrateType.CAL_BREW_100: case CalibrateType.CAL_BREW_75: case CalibrateType.CAL_BREW_50: case CalibrateType.CAL_CARBON: case CalibrateType.CAL_COLD: case CalibrateType.CAL_COLD_MIX: //grd_test_brew.Visibility = System.Windows.Visibility.Visible; //this.grd_test.Visibility = Visibility.Hidden; //this.grd_cal.Visibility = System.Windows.Visibility.Hidden; //this.grd_test_temp.Visibility = System.Windows.Visibility.Hidden; //this.tb_brew.Text = cltype.ToString(); if (MessageBox.Show(this, "Please place the cup,then press the ok to start!", "Calibration", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { M2BCalibration calcmd = new M2BCalibration(_CalPartNo, _CalValue); byte[] sendcmd = calcmd.EnCode(); lock (this) { comunication.Getinstance().AddtoSend(sendcmd, (byte)sendcmd.Length); } //this.grd_Process.Visibility = System.Windows.Visibility.Visible; //Tmrpb.Start(); } break; case CalibrateType.CAL_TEMPERATURE: grd_test_brew.Visibility = System.Windows.Visibility.Hidden; this.grd_test.Visibility = Visibility.Hidden; this.grd_cal.Visibility = System.Windows.Visibility.Hidden; this.grd_test_temp.Visibility = System.Windows.Visibility.Visible; this.tb_title1.Text = cltype.ToString(); //TODO:开启温度查询 Tmr.Start(); break; default: break; } }
private void Cal_Click(object sender, RoutedEventArgs e) { Button tmp = sender as Button; if (_CalPartNo != byte.Parse(tmp.Tag.ToString()) || _CalValue == 0) { MessageBox.Show("Error!"); return; } CalibrateType cltype = (CalibrateType)int.Parse(tmp.Tag.ToString()); this.tb_title_cal.Text = cltype.ToString(); this.grd_cal.Visibility = System.Windows.Visibility.Visible; switch (cltype) { case CalibrateType.CAL_HOT: CalInport1.Maximum = 1000; CalInport1.Minimum = 50; break; case CalibrateType.CAL_HOT_BREW: CalInport1.Maximum = 1000; CalInport1.Minimum = 50; break; case CalibrateType.CAL_HOT_MIX_ONE: CalInport1.Maximum = 1000; CalInport1.Minimum = 50; break; case CalibrateType.CAL_HOT_MIX_TWO: CalInport1.Maximum = 1000; CalInport1.Minimum = 50; break; case CalibrateType.CAL_CANISTER_ONE: CalInport1.Maximum = 100; CalInport1.Minimum = 20; break; case CalibrateType.CAL_CANISTER_TWO: CalInport1.Maximum = 100; CalInport1.Minimum = 20; break; case CalibrateType.CAL_CANISTER_THREE: CalInport1.Maximum = 100; CalInport1.Minimum = 20; break; case CalibrateType.CAL_CANISTER_FOUR: CalInport1.Maximum = 100; CalInport1.Minimum = 20; break; case CalibrateType.CAL_BREW_100: case CalibrateType.CAL_BREW_75: case CalibrateType.CAL_BREW_50: this.grd_cal.Visibility = System.Windows.Visibility.Hidden; break; case CalibrateType.CAL_TEMPERATURE: this.grd_cal.Visibility = System.Windows.Visibility.Hidden; break; default: break; } }