예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ConfigValue value = _controlManager.getValueFromControls(currentStatus);
                if (value != null)
                {
                    switch (currentStatus)
                    {
                    case "Vacuum":
                        _vacuums.addValue(value as VacuumValue);
                        TotalTIme.Text  = "Dif de Tempo com a Temperatura: " + (_temperatures.getTotalTime() - _vacuums.getTotalTime()).ToString();
                        TotalTIme.Text += " | Tempo total: " + _vacuums.getTotalTime().ToString();
                        break;

                    case "Pressure":
                        _pressures.addValue(value as PressureValue);
                        TotalTIme.Text  = "Dif de Tempo com a Temperatura: " + (_temperatures.getTotalTime() - _pressures.getTotalTime()).ToString();
                        TotalTIme.Text += " | Tempo total: " + _pressures.getTotalTime().ToString();
                        break;

                    case "Temperature":
                        _temperatures.addValue(value as TemperatureValue);
                        TotalTIme.Text = "Tempo total: " + _temperatures.getTotalTime().ToString();

                        break;

                    default:
                        throw new FormatException("Data Type Not Found");
                    }
                }
                else
                {
                    MessageBox.Show("Dados Invalidos", "Dados Inválidos");
                }

                ValueGrid.Items.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Dados Invalidos");
            }
        }