Beispiel #1
0
        private async void LoginButton_Clicked(object sender, EventArgs e)
        {
            LoginButton.Text      = "LOGGING IN...";
            LoginButton.IsEnabled = false;

            CloudOperationResult opResult = await Users.Login(EmailEntry.Text, PasswordEntry.Text);

            if (opResult.Success == false)
            {
                await DisplayAlert("Error", ApplicationErrors.GetError(opResult.Error).Message, "OK");

                LoginButton.Text      = "LOG IN";
                LoginButton.IsEnabled = true;
                return;
            }

            LoginButton.Text      = "LOG IN";
            LoginButton.IsEnabled = true;
            Navigation.InsertPageBefore(new HomePage(), this);
            await Navigation.PopAsync();
        }
Beispiel #2
0
        private async void RegisterButton_Clicked(object sender, EventArgs e)
        {
            if (PasswordEntry.Text == PasswordConfirmEntry.Text)
            {
                var result = await Users.RegisterUser(user);

                if (result.Success == false)
                {
                    switch (result.Error)
                    {
                    case ErrorCode.UserExists:
                        await DisplayAlert("Error", ApplicationErrors.GetError(result.Error).Message, "OK");

                        return;
                    }
                }

                await DisplayAlert("Success", "You have successfully registered!", "OK");
            }
            else
            {
                await DisplayAlert("Error", ApplicationErrors.GetError(ErrorCode.PasswordMismatch).Message, "OK");
            }
        }