示例#1
0
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            Clima climaTemp = new Clima();

            climaTemp.Codigo        = cmbDepartamento.SelectedValue.ToString();
            climaTemp.Temperatura   = float.Parse(txtTemperatura.Text);
            climaTemp.FechaMedicion = mcFecha.SelectionStart;

            climas.Add(climaTemp);

            GuardarTemperatura();
            Limpiar();
        }
示例#2
0
        private void LeerTemperatura()
        {
            if (File.Exists("Temperaturas.txt"))
            {
                FileStream   stream = new FileStream("Temperaturas.txt", FileMode.Open, FileAccess.Read);
                StreamReader reader = new StreamReader(stream);

                while (reader.Peek() > -1)
                {
                    Clima climaTemp = new Clima();
                    climaTemp.Codigo        = reader.ReadLine();
                    climaTemp.Temperatura   = float.Parse(reader.ReadLine());
                    climaTemp.FechaMedicion = Convert.ToDateTime(reader.ReadLine());

                    climas.Add(climaTemp);
                }
                reader.Close();
            }
        }