/// <summary>
 /// Para guardar la velocidad del ejercicio
 /// </summary>
 private async Task GuardarHistorialAsync()
 {
     GuardarInformacionServices guardarInformacionServices = new GuardarInformacionServices();
     await guardarInformacionServices.GuardarInformacion(this.ejercicio);
 }
Beispiel #2
0
 /// <summary>
 /// Para agregar las filas de los ejercicios: cada fila tiene la columnas: velocidad, tiempo & palabras
 /// </summary>
 private async Task CargaItems()
 {
     if (!this.IsBusy)
     {
         this.IsBusy = true;
         GuardarInformacionServices guardarInformacionServices = new GuardarInformacionServices();
         List <Ejercicio>           historico = guardarInformacionServices.ObtenerInformacion();
         if (historico != null)
         {
             if (historico.Count > 0)
             {
                 int   row = 0;
                 Label lblVelocidadTitulo = new Label()
                 {
                     Text     = "VELOCIDAD",
                     FontSize = 18,
                     HorizontalTextAlignment = TextAlignment.Center
                 };
                 Label lblTiempoTitulo = new Label()
                 {
                     Text     = "TIEMPO",
                     FontSize = 18,
                     HorizontalTextAlignment = TextAlignment.Center
                 };
                 Label lblPalabrasTitulo = new Label()
                 {
                     Text     = "PALABRAS",
                     FontSize = 18,
                     HorizontalTextAlignment = TextAlignment.Center
                 };
                 HistoricoGrid.Children.Add(lblVelocidadTitulo, 0, row);
                 HistoricoGrid.Children.Add(lblTiempoTitulo, 1, row);
                 HistoricoGrid.Children.Add(lblPalabrasTitulo, 2, row);
                 row++;
                 for (var i = historico.Count - 1; i >= 0; i--)
                 {
                     decimal velocidad = 0;
                     try
                     {
                         velocidad = decimal.Round(historico[i].PalabrasLeidas / historico[i].Segundos, 3);
                     }
                     catch (Exception e)
                     {
                         Console.Write(e);
                     }
                     Label lblVelocidad = new Label()
                     {
                         Text      = velocidad + "/segundo",
                         FontSize  = 18,
                         TextColor = Color.FromHex("#d6450c"),
                         HorizontalTextAlignment = TextAlignment.Center
                     };
                     Label lblTiempo = new Label()
                     {
                         Text     = historico[i].Segundos + " s",
                         FontSize = 18,
                         HorizontalTextAlignment = TextAlignment.Center
                     };
                     Label lblPalabras = new Label()
                     {
                         Text     = "" + historico[i].PalabrasLeidas,
                         FontSize = 18,
                         HorizontalTextAlignment = TextAlignment.Center
                     };
                     HistoricoGrid.Children.Add(lblVelocidad, 0, row);
                     HistoricoGrid.Children.Add(lblTiempo, 1, row);
                     HistoricoGrid.Children.Add(lblPalabras, 2, row);
                     row++;
                 }
             }
             else
             {
                 Label lblNoHayHistorial = new Label()
                 {
                     Text     = "No hay historial :(",
                     FontSize = 18,
                     HorizontalTextAlignment = TextAlignment.Center
                 };
                 HistoricoGrid.Children.Add(lblNoHayHistorial, 1, 0);
             }
         }
         ViewEspera.IsVisible     = false;
         FrameEspera.IsVisible    = false;
         ActivityEspera.IsVisible = false;
         ActivityEspera.IsRunning = false;
         this.IsBusy = false;
     }
 }