Example #1
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            // check for errors
            string error = ValidateFields();

            if (error != null)
            {
                MessageBox.Show(this, error, "User Settings");
                return;
            }

            bool verify = false;

            // set user name
            if (Profile.Settings.UserName != NameBox.Text)
            {
                verify = true;
            }

            // set password
            if (NewPassBox.Text != "")
            {
                verify = true;
            }

            // save
            if (verify && GuiUtils.VerifyPassphrase(Profile.Core, ThreatLevel.High))
            {
                Profile.Settings.UserName = NameBox.Text;

                if (NewPassBox.Text != "")
                {
                    Profile.SetNewPassword(NewPassBox.Text);
                }

                Profile.Core.RunInCoreAsync(delegate()
                {
                    Profile.Save();
                    Profile.Core.Trust.SaveLocal();
                });
            }


            Close();
        }