示例#1
0
 private void ClickAdd(object sender, EventArgs e)
 {
     //que hacer cuando se da click al boton add
     if (nombreText.Text.Equals("") || nombreText.Text.Equals("Name of the pet") || edadText.Text.Equals("pet age"))
     {
         edadText.Text = "";
     }
     else
     {
         mascota.nombre      = nombreText.Text;
         mascota.estado      = 1;
         mascota.descripcion = descripcionText.Text;
         mascota.edad        = int.Parse(edadText.Text);
         mascota.tipo        = tipoSpin.SelectedItemPosition + 1;
         mascota.user_alta   = user.id_user;
         if (id > -1)
         {
             conMas.editarMascota(mascota);
         }
         else
         {
             byte[] bitmapData;
             using (var stream = new MemoryStream())
             {
                 App.bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
                 bitmapData = stream.ToArray();
             }
             MemoryStream ms = new MemoryStream(bitmapData);
             conMas.publicarMascota(mascota, ms);
         }
         Finish();
     }
 }
示例#2
0
 private void confirmBtn_Click(object sender, RoutedEventArgs e)
 {
     m.nombre      = nombreBox.Text;
     m.descripcion = descripcionBox.Text;
     m.edad        = int.Parse(edadBox.Text);
     m.tipo        = tipoBox.SelectedIndex + 1;
     if (edita)
     {
         conMas.editarMascota(m);
     }
     else
     {
         conMas.publicarMascota(m, stream.AsStream());
     }
     Frame.Navigate(typeof(MainPage), user);
 }