protected override void OnCreate(Bundle savedInstanceState) { // Set our view from the "main" layout resource SetContentView(Resource.Layout.Foto); base.OnCreate(savedInstanceState); datos_usuario = JsonConvert.DeserializeObject <cls_usuario>(Intent.GetStringExtra("datos_usuario")); datos_paciente = JsonConvert.DeserializeObject <cls_paciente>(Intent.GetStringExtra("datos_paciente")); datos_informacion = JsonConvert.DeserializeObject <cls_informacion>(Intent.GetStringExtra("datos_informacion")); TextView lbl_nombre = FindViewById <TextView>(Resource.Id.lbl_nombre); TextView lbl_edad = FindViewById <TextView>(Resource.Id.lbl_edad); DateTime date = DateTime.Now; int year = date.Year; int ano_nac = datos_paciente.fecnac.Year; int edad = year - ano_nac; int max = datos_paciente.nombre_com.Length; if (max > 20) { max = 23; } lbl_nombre.Text = "Id:" + datos_paciente.id_paciente.ToString() + " " + datos_paciente.nombre_com.Substring(0, max) + "."; lbl_edad.Text = edad.ToString(); TextView lbl_episodio_foto = FindViewById <TextView>(Resource.Id.lbl_episodio_foto); lbl_episodio_foto.Text = "Ep.:" + datos_informacion.id_episodio.ToString() + " Fecha:" + datos_informacion.fecha + " (" + datos_informacion.veo.ToString() + ")"; if (datos_informacion.veo > 0) { Mostar_Foto(); } Button btn_borra_foto = FindViewById <Button>(Resource.Id.btn_borra_foto); btn_borra_foto.Click += btn_borra_foto_Click; Button btn_foto_mas = FindViewById <Button>(Resource.Id.btn_foto_mas); btn_foto_mas.Click += btn_foto_mas_Click; Button btn_foto_menos = FindViewById <Button>(Resource.Id.btn_foto_menos); btn_foto_menos.Click += btn_foto_menos_Click; if (IsThereAnAppToTakePictures()) { CreateDirectoryForPictures(); Button button = FindViewById <Button>(Resource.Id.btn_camara); button.Click += TomarFoto; } }
private void btn_foto_Click(object sender, EventArgs eventArgs) { if (datos_informacion.id_episodio == 0) { string cabecera = "ERROR"; string mensaje = "Antes de realizar fotos a " + datos_paciente.nombre_com + ", debe crear o seleccionar un episodio."; ShowAlert(cabecera, mensaje, "S", 0, null, null); } else { //Busca en el episodio la primera imagen TRAtaMeWS.TRAtaMeWS TRAtaMe = new TRAtaMeWS.TRAtaMeWS(); datos_informacion.veo_tipo = "F"; datos_informacion.veo = TRAtaMe.dame_id_multimed(datos_informacion.veo_tipo, datos_informacion, "MIN"); datos_informacion = TRAtaMe.dame_img_aud(datos_informacion.veo_tipo, " id = " + datos_informacion.veo.ToString() + " Order by id", datos_informacion); Intent intent = new Intent(this, typeof(FotoActivity)); intent.PutExtra("datos_usuario", JsonConvert.SerializeObject(datos_usuario)); intent.PutExtra("datos_paciente", JsonConvert.SerializeObject(datos_paciente)); intent.PutExtra("datos_informacion", JsonConvert.SerializeObject(datos_informacion)); this.StartActivity(intent); } }
private void btn_foto_menos_Click(object sender, EventArgs eventArgs) { TRAtaMeWS.TRAtaMeWS TRAtaMe = new TRAtaMeWS.TRAtaMeWS(); string el_where = ""; string tipo = "F"; int veo_oigo = 0; if (tipo == "A") { veo_oigo = datos_informacion.oigo; } else { veo_oigo = datos_informacion.veo; } int el_id_MAX = TRAtaMe.dame_id_multimed(tipo, datos_informacion, "MAX"); int el_id_MIN = TRAtaMe.dame_id_multimed(tipo, datos_informacion, "MIN"); if (el_id_MIN < veo_oigo) { el_where = "id < " + veo_oigo; } else { if (el_id_MAX >= veo_oigo) { el_where = "id = " + el_id_MAX; } } el_where = el_where + " Order by id desc"; datos_informacion = TRAtaMe.dame_img_aud(tipo, el_where, datos_informacion); Mostar_Foto(); }