private void consultar_Click(object sender, EventArgs e) { String ValPropiedad = propiedad.Text; String res = "NOK"; if (ValPropiedad.Length != 0 && stationList.Text != "") { try { switch (ValPropiedad) { case "Temperatura": res = estacionActual.getTemperatura().ToString(); break; case "Humedad": res = estacionActual.getHumedad().ToString(); break; case "Luminosidad": res = estacionActual.getLuminosidad().ToString(); break; case "Pantalla": res = estacionActual.getPantalla(); break; } crearLog("get", ValPropiedad); if (encriptado) { try { resPropiedad.Text = AesBase64Wrapper.DecodeAndDecrypt(res); } catch (Exception ex) { } } else { resPropiedad.Text = res; } } catch (Exception ex) { error("Esta estación se encuentra inactiva!"); } } else { error(error_propiedad_no_seleccionada); } }
private void estacionSeleccionada(object sender, EventArgs e) { String stationText = stationList.SelectedItem.ToString(); Estacion.Estacion estacion = estaciones[stationText]; try { estacion.getPantalla(); estacionActual = estacion; } catch (Exception exep) { error("Estacion se encuentra inhabilitada!"); estaciones.Remove(stationText); } }