예제 #1
0
        private void btnUnmatch_Click(object sender, RoutedEventArgs e)
        {
            if (lsbMatches.SelectedIndex < 0)
            {
                MessageBox.Show("You need to select a match before you can unmatch");
                return;
            }

            ConfimWithLogin confirmWithLogin = new ConfimWithLogin();

            confirmWithLogin.ShowDialog();

            if (App.Current.Resources["confirmWithLoginBool"].ToString() == "True")
            {
                myViewMatchesViewModel.viewMatchesRepo.unmatch(lsbMatches.SelectedIndex);
                MessageBox.Show("Unmatch succesful.");
                ViewMatches viewMatches = new ViewMatches();
                viewMatches.Show();
                this.Close();
            }
            else
            {
                return;
            }
        }
예제 #2
0
        private void btnDeleteAccount_Click(object sender, RoutedEventArgs e)
        {
            ConfimWithLogin confirmWithLogin = new ConfimWithLogin();

            confirmWithLogin.ShowDialog();

            if (App.Current.Resources["confirmWithLoginBool"].ToString() == "True")
            {
                try
                {
                    mySettingsViewModel.settingsRepo.getUserInfo(App.Current.Resources["loginEmail"].ToString());
                    mySettingsViewModel.settingsRepo.deleteAccount();

                    MessageBox.Show("Your account has been deleted.");
                    Login login = new Login();
                    login.Show();
                    this.Close();
                }
                catch (Exception exc) { MessageBox.Show(exc.Message); }
            }
            else
            {
                return;
            }
        }
예제 #3
0
        private void btnSaveChanges_Click(object sender, RoutedEventArgs e)
        {
            string genderPref = "";

            if (cmbBoxUpdateGenderPref.Text == "Male")
            {
                genderPref = "M";
            }
            else if (cmbBoxUpdateGenderPref.Text == "Female")
            {
                genderPref = "F";
            }
            else if (cmbBoxUpdateGenderPref.Text == "Other")
            {
                genderPref = "O";
            }

            if (txtBoxUpdatePassword.Password != txtBoxUpdateConfirmPass.Password)
            {
                MessageBox.Show("Your password doesn't match.");
                return;
            }

            if (Int16.TryParse(txtBoxUpdateMinAgePref.Text, out short minAgePref) && Int16.TryParse(txtBoxUpdateMaxAgePref.Text, out short maxAgePref))
            {
            }
            else if (txtBoxUpdateMinAgePref.Text == "" && txtBoxUpdateMaxAgePref.Text == "")
            {
            }
            else
            {
                MessageBox.Show("Your age preference is not in the right format.");
                return;
            }

            ConfimWithLogin confirmWithLogin = new ConfimWithLogin();

            confirmWithLogin.ShowDialog();

            if (App.Current.Resources["confirmWithLoginBool"].ToString() == "True")
            {
                try
                {
                    mySettingsViewModel.settingsRepo.getUserInfo(App.Current.Resources["loginEmail"].ToString());

                    mySettingsViewModel.settingsRepo.updateEmail(txtBoxUpdateEmail.Text);
                    mySettingsViewModel.settingsRepo.updatePassword(txtBoxUpdatePassword.Password);
                    mySettingsViewModel.settingsRepo.updateShortDesc(txtBoxUpdateShortDesc.Text);
                    mySettingsViewModel.settingsRepo.updateProfilePic(App.Current.Resources["updateProfilePicPath"].ToString());
                    mySettingsViewModel.settingsRepo.updateGenderPref(genderPref);
                    mySettingsViewModel.settingsRepo.updateMinAgePref(txtBoxUpdateMinAgePref.Text);
                    mySettingsViewModel.settingsRepo.updateMaxAgePref(txtBoxUpdateMaxAgePref.Text);

                    MessageBox.Show("Your changes have been saved.");
                    Login login = new Login();
                    login.Show();
                    this.Close();
                }
                catch (Exception) { MessageBox.Show("Error: something went wrong"); }
            }
            else
            {
                return;
            }
        }