Ejemplo n.º 1
0
        private void btnEncrypt_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtPassword.Text))
            {
                return;
            }

            Cursor.Current      = Cursors.WaitCursor;
            btnEncrypt.Enabled  = false;
            txtPassword.Enabled = false;

            if (UserConfigService.Encrypted && !EncryptionService.ValidatePassword(txtPassword.Text))
            {
                MessageBox.Show("Incorrect password.");
            }
            else if (UserConfigService.Encrypted)
            {
                EncryptionService.DecryptFiles();
            }
            else
            {
                EncryptionService.EncryptFiles(txtPassword.Text);
            }

            Setup();
        }