async void SaveTool() { var fecha = Datepicker.ToString("dd/MM/yyyy"); await Application.Current.MainPage.DisplayAlert( "Hola", fecha + " " + Responsable + " " + MariolaAlzas + " " + SoncuanoAlzas + " " + TotalAlzas + " " + MariolaKg + " " + SoncuanoKg + " " + TotalKg + " " + PrecioCompra + " " + TotalPagar + " " + Comentario, "Aceptar"); }
async void Guardar() { IsEnabled = false; var fecha = Datepicker.ToString("dd/MM/yyyy"); #region Miranda: Guardar Tabla #region Limpiar Cache //borrar los datos existentes en persistencia if (Application.Current.Properties.ContainsKey("ContadorMieles")) { Elementos = int.Parse((Application.Current.Properties["ContadorMieles"]) as string); } else { Elementos = 0; } for (int j = 0; j < Elementos; j++) //Elementos va a representar el total de elementos o filas existentes en mi persistencia { if (Application.Current.Properties.ContainsKey("Lote" + j)) { Application.Current.Properties.Remove("Lote" + j); } if (Application.Current.Properties.ContainsKey("Especie" + j)) { Application.Current.Properties.Remove("Especie" + j); } if (Application.Current.Properties.ContainsKey("Alza" + j)) { Application.Current.Properties.Remove("Alza" + j); } if (Application.Current.Properties.ContainsKey("Peso")) { Application.Current.Properties.Remove("Peso"); } } #endregion #region Ciclo para Guardar en Persistencia i = 0; //inicio el contador de mis elementos o filas en (0) foreach (var miel in Mieles) { Application.Current.Properties["Lote" + i] = miel.Lote.ToString(); Application.Current.Properties["Especie" + i] = miel.Especie.ToString(); Application.Current.Properties["Alza" + i] = miel.Alza.ToString(); Application.Current.Properties["Peso" + i] = miel.Peso.ToString(); i++; Application.Current.Properties["ContadorMieles"] = i.ToString(); await Application.Current.SavePropertiesAsync(); } #endregion int filas; HeighListView = 44 * i; if (Application.Current.Properties.ContainsKey("ContadorMieles")) { filas = int.Parse(Application.Current.Properties["ContadorMieles"] as string); } else { filas = 0; } filas = Mieles.Count; await Application.Current.MainPage.DisplayAlert("Notificación", "El Numero de Lotes Guardados es: " + filas.ToString(), "Excelente"); #endregion await Application.Current.MainPage.DisplayAlert( "Hola", fecha + " " + Responsable + " " + MariolaAlzas + " " + SoncuanoAlzas + " " + TotalAlzas + " " + MariolaKg + " " + SoncuanoKg + " " + TotalKg + " " + PrecioCompra + " " + TotalPagar + " " + Comentario, "Aceptar"); IsEnabled = true; }