Exemplo n.º 1
0
        private async void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            while (true)
            {
                try
                {
                    EscribirLinea("Acerque su tarjeta\npara ingresar/retirar su bicicleta", true);
                    //llamo al lector
                    var lectura = await _lector.GetDataAsync();

                    if (lectura != "-1" && lectura != "0") //si es valida
                    {
                        EscribirLinea(String.Format("Lectura: {0}", lectura), true);
                        var slot = await _servicio.IncommingReadAsync("Lector1", lectura);

                        EscribirLinea(slot == "0" ? String.Format("Estacionamiento lleno") : slot.StartsWith("E") ? String.Format("Retire su bicicleta por el slot {0}", slot) : String.Format("Ingrese su bicicleta en el slot {0}", slot));
                    }
                    await Task.Delay(2000);
                }
                catch
                {
                }
            }
        }