public string Readtemp(StreamReader sr) { string line = sr.ReadLine(); if (string.IsNullOrEmpty(line)) { return(null); } int i = 10; while (line.Substring(0, 1) != "#") { var values = line.Split(';'); TemperatureValue tempValue = new TemperatureValue(); tempValue.Id = i.ToString(); string type = values[0] == "0" ? "Rampa" : "Patamar"; tempValue.Tipo = type; tempValue.SetPoint = String.IsNullOrEmpty(values[1])? null : Convert.ToDouble(values[1], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); tempValue.Taxa = String.IsNullOrEmpty(values[2]) ? null : Convert.ToDouble(values[2], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); tempValue.Tempo = String.IsNullOrEmpty(values[3]) ? null : Convert.ToInt32(values[3], System.Globalization.CultureInfo.InvariantCulture).ToString(); tempValue.Tolerancia = String.IsNullOrEmpty(values[4]) ? null : Convert.ToDouble(values[4], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); tempValue.TxMinima = String.IsNullOrEmpty(values[5]) ? null : Convert.ToDouble(values[5], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); tempValue.TxMaxima = String.IsNullOrEmpty(values[6]) ? null : Convert.ToDouble(values[6], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); tempValue.TempoHold = String.IsNullOrEmpty(values[7]) ? null : Convert.ToInt32(values[7].Split('.')[0].Split(',')[0]).ToString(); _temperatureRepository.addValue(tempValue); i += 10; line = sr.ReadLine(); if (string.IsNullOrEmpty(line)) { return(null); } } return(line); }
public string ReadPressure(StreamReader sr) { string line = sr.ReadLine(); if (string.IsNullOrEmpty(line)) { return(null); } int i = 10; while (line.Substring(0, 1) != "#") { var values = line.Split(';'); PressureValue presValue = new PressureValue(); presValue.Id = i.ToString(); string type = values[0] == "0" ? "Rampa" : "Patamar"; presValue.Tipo = type; presValue.SetPoint = String.IsNullOrEmpty(values[1]) ? null : Convert.ToDouble(values[1], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture);; presValue.Taxa = String.IsNullOrEmpty(values[2]) ? null : Convert.ToDouble(values[2], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); presValue.Tempo = values[3]; presValue.Tolerancia = String.IsNullOrEmpty(values[4]) ? null : Convert.ToDouble(values[4], System.Globalization.CultureInfo.InvariantCulture).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture); i += 10; _pressureRepository.addValue(presValue); line = sr.ReadLine(); if (string.IsNullOrEmpty(line)) { return(null); } } return(line); }
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"); } }