private async void confirmButton_Click(object sender, RoutedEventArgs e)
        {
            newUsername     = newUsernameTextBox.Text.ToString();
            newPassword     = newPasswordTextBox.Text.ToString();
            confirmPassword = confirmPasswordTextBox.Text.ToString();

            //Password dozvoljena samo slova, brojevi i _, mora imati barem jedno veliko slovo i jedan broj, min duzina 6
            //Username dozvoljena samo mala slova, brojevi i _, mora biti jedinstven,  min duzina 6

            //Validacija promjena

            //Validiraj username
            if (changeUsername)
            {
                if (!ValidacijaUser.validateUsernameLength(newUsername).Item1)
                {
                    errorTextBox.Visibility = Visibility.Visible;
                    errorTextBox.Text       = "Username must contain atleast 6 characters!";
                    return;
                }
                if (!ValidacijaUser.validateUsernameContent(newUsername).Item1)
                {
                    errorTextBox.Visibility = Visibility.Visible;
                    errorTextBox.Text       = "Username must contain atleast one number! Username can contain only lower case letters, numbers and '_'. ";
                    return;
                }


                usernameTextBox.Text = newUsernameTextBox.Text.ToString();

                //Unos u bazu

                bool izmjenjen = await auvm.changeUsername(id, newUsername);

                if (izmjenjen)
                {
                    var dialog = new MessageDialog("Username changed successfully!");
                    await dialog.ShowAsync();
                }

                PocetnaFormaViewModel.setUsernameG(newUsername);
                Initiale();
            }


            //Validacija passworda
            if (changePassword)
            {
                if (!ValidacijaUser.validatePasswordLength(newPassword).Item1)
                {
                    errorTextBox.Visibility = Visibility.Visible;
                    errorTextBox.Text       = "Password must contain atleast 6 characters!";
                    return;
                }

                if (!ValidacijaUser.validatePasswordContent(newPassword).Item1)
                {
                    errorTextBox.Visibility = Visibility.Visible;
                    errorTextBox.Text       = "Password must contain atleast one number and one UpperCase letter! Password can only contain letters, numbers and '_'. ";
                    return;
                }


                if (!ValidacijaUser.validatePasswordConfirmPassword(newPassword, confirmPassword).Item1)
                {
                    errorTextBox.Visibility = Visibility.Visible;
                    errorTextBox.Text       = "New password is not equal to Confirm password!";
                    return;
                }
                errorTextBox.Text       = "";
                errorTextBox.Visibility = Visibility.Collapsed;
                passwordTextBox.Text    = newPasswordTextBox.Text.ToString();

                //Unos u bazu

                bool izmjenjen = await auvm.changePassword(id, newPassword);

                if (izmjenjen)
                {
                    var dialog = new MessageDialog("Password changed successfully!");
                    await dialog.ShowAsync();
                }
                PocetnaFormaViewModel.setPasswordG(newPassword);
                Initiale();
            }

            //Sve uredu, uspješan unos
            errorTextBox.Visibility             = Visibility.Collapsed;
            newUsernameTextBox.Visibility       = Visibility.Collapsed;
            newUsernameTextBlock.Visibility     = Visibility.Collapsed;
            newPasswordTextBlock.Visibility     = Visibility.Collapsed;
            newPasswordTextBox.Visibility       = Visibility.Collapsed;
            confirmPasswordTextBlock.Visibility = Visibility.Collapsed;
            confirmPasswordTextBox.Visibility   = Visibility.Collapsed;

            newUsernameTextBox.Text     = "";
            newPasswordTextBox.Text     = "";
            confirmPasswordTextBox.Text = "";

            changePassword = false;
            changeUsername = false;
        }
        private async void Update_Click(object sender, RoutedEventArgs e)
        {
            newFirstName = firstName.Text;
            newLastName  = lastName.Text;
            newPassword  = NewPassword.Text;
            newUsername  = Username.Text;
            newEmail     = Email.Text;
            String poruka = "";

            if (newFirstName != regUser.FirstName)
            {
                Tuple <bool, String> rez = ValidacijaUser.validateFirstName(newFirstName);
                poruka += rez.Item2 + "\n";
                if (rez.Item1)
                {
                    //Vrsimo upis novih podataka u bazu
                    if (await upvm.changeFirstName(id, newFirstName))
                    {
                        regUser.FirstName = newFirstName;
                    }
                }
            }
            if (newLastName != regUser.LastName)
            {
                Tuple <bool, String> rez = ValidacijaUser.validateLastName(newLastName);
                poruka += rez.Item2 + "\n";
                if (rez.Item1)
                {
                    //Vrsimo upis novih podataka u bazu
                    if (await upvm.changeLastName(id, newFirstName))
                    {
                        regUser.LastName = newLastName;
                    }
                }
            }
            if (newPassword != regUser.Password)
            {
                Tuple <bool, String> rez1 = ValidacijaUser.validatePasswordLength(newPassword);
                Tuple <bool, String> rez2 = ValidacijaUser.validatePasswordContent(newPassword);
                //Validacija

                if (!rez1.Item1)
                {
                    poruka += rez1.Item2 + "\n";
                }
                else if (!rez2.Item1)
                {
                    poruka += rez2.Item2 + "\n";
                }
                else
                {
                    poruka += "New password is valid.\n";
                    //Vrsimo upis u bazu
                    bool izmjenjen = await upvm.changePassword(id, newPassword);

                    if (izmjenjen)
                    {
                        PocetnaFormaViewModel.setPasswordG(newPassword);
                        regUser.Password = newPassword;
                    }
                }
            }
            if (newEmail != regUser.Email)
            {
                Tuple <bool, String> rez = ValidacijaUser.validateEmail(newEmail);
                poruka += rez.Item2 + "\n";
                if (rez.Item1)
                {
                    //Vrsimo upis novih podataka u bazu
                    if (await upvm.changeEmail(id, newEmail))
                    {
                        regUser.Email = newEmail;
                    }
                }
            }
            if (newUsername != regUser.Username)
            {
                Tuple <bool, String> rez1 = ValidacijaUser.validateUsernameLength(newUsername);
                Tuple <bool, String> rez2 = ValidacijaUser.validateUsernameContent(newUsername);
                //Validacija
                if (rez1.Item1 && rez2.Item1)
                {
                    poruka += "New username is valid.\n";
                    //Vrsimo upis novih podataka u bazu
                    bool izmjenjen = await upvm.changeUsername(id, newUsername);

                    if (izmjenjen)
                    {
                        PocetnaFormaViewModel.setUsernameG(newUsername);
                        regUser.Username = newUsername;
                    }
                }
                else
                {
                    if (!rez1.Item1)
                    {
                        poruka += rez1.Item2;
                    }
                    if (!rez2.Item1)
                    {
                        poruka += "\n" + rez2.Item2;
                    }
                }
            }


            messageDialog(poruka);
            //Refresh form



            //this.Frame.Navigate(typeof(SearchRestaurants));
        }