Example #1
0
        private async Task queryUser()
        {
            var tokenSource2     = new CancellationTokenSource();
            CancellationToken ct = tokenSource2.Token;

            try
            {
                var person = await FirebaseHelper.GetUser(entryDNI.Text, entryPass.Text);

                if (person != null)
                {
                    if (entryDNI.Text == person.DNI)
                    {
                        App.u = person;
                    }
                }
                else
                {
                    var message = "Usuario incorrecto";
                    DependencyService.Get <IMessage>().LongTime(message);
                    entryDNI.Text  = "";
                    entryPass.Text = "";
                }
            }
            catch (OperationCanceledException e)
            {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
            finally
            {
                tokenSource2.Dispose();
                Navigation.PushModalAsync(new MainPage());
            }
        }