Exemple #1
0
        private async void LogIn_Clicked(object sender, EventArgs e)
        {
            try
            {
                var azure = new UserAzure();
                var users = await azure.GetUsers();

                var userr = new User();

                //bool Success = true;

                foreach (var user in users)
                {
                    if (user.Email == emailEntry.Text && user.Password == passwordEntry.Text)
                    {
                        await DisplayAlert("Registration", "Successfully logged in!", "OK");

                        //Success = true;
                        OnThresholdReached(EventArgs.Empty);
                    }
                }
                emailEntry.Text    = String.Empty;
                passwordEntry.Text = String.Empty;
                //Success = false;
                await DisplayAlert("Registration", "Logging in unsuccessfull!", "OK");
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Wyjatek przy logowaniu: " + ex);
            }
        }
Exemple #2
0
        public async Task ExecuteLoadUsersCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Users.Clear();
                var users = await azureServices.GetUsers();

                foreach (var user in users)
                {
                    Users.Add(user);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("UserViewModel LoadUser Failure: " + ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #3
0
        async private void Button_Clicked(object sender, EventArgs e)
        {
            bool Success = true;

            var azure = new UserAzure();
            var users = azure.GetUsers();
            var userr = new User();

            foreach (var user in users.Result)
            {
                if (user.UserName == usernameEntry.Text)
                {
                    await DisplayAlert("Registration", "Username is already in use!", "OK");

                    usernameEntry.Text = String.Empty;
                    Success            = false;
                    break;
                }
                if (user.Email == emailEntry.Text)
                {
                    await DisplayAlert("Registration", "E-mail is already in use!", "OK");

                    emailEntry.Text = String.Empty;
                    Success         = false;
                    break;
                }
            }

            if (passwordEntry != password2Entry)
            {
                await DisplayAlert("Regitration", "Passwords don't match!", "OK");

                passwordEntry.Text  = String.Empty;
                password2Entry.Text = String.Empty;
                Success             = false;
            }
            if (Success == true)
            {
                userr.Email    = emailEntry.Text;
                userr.Password = passwordEntry.Text;
                userr.UserName = usernameEntry.Text;
                await azure.AddUser(userr);
                await DisplayAlert("Registration", "Registration completed successfully!", "OK");

                OnThresholdReached(EventArgs.Empty);
            }
        }