private void saveStateCheckBox_Click(object sender, EventArgs e)
        {
            // need to prevent the user from going to an open terminal and clearing
            // the save state, then setting the master password to anything they like

            // saveStateCheckBox.Checked was the state before the click
            // if previously checked, the user is trying to clear it => authorization maybe required
            // (depending on the state of the requireMasterPasswordCheckBox; this should be cleared too if checked)

            if (saveStateCheckBox.Checked && requireMasterPasswordCheckBox.Checked)
            {
                using (var enterPassword = new EnterMasterPasswordDialog(TemporaryMasterPassword))
                {
                    if (enterPassword.ShowDialog(this) == DialogResult.OK)
                    {
                        TemporaryMasterPassword = null;
                        saveStateCheckBox.Checked = false;
                        requireMasterPasswordCheckBox.Checked = false;
                        masterPasswordGroupBox.Enabled = false;
                    }
                }
            }
            else
            {
                saveStateCheckBox.Checked = !saveStateCheckBox.Checked;
                masterPasswordGroupBox.Enabled = saveStateCheckBox.Checked;
                changeMasterPasswordButton.Enabled = requireMasterPasswordCheckBox.Checked;
            }
        }
        private void requireMasterPasswordCheckBox_Click(object sender, EventArgs e)
        {
            // requireMasterPasswordCheckBox.Checked was the state before the click
            // if previously checked, the user is trying to clear it => request authorization
            // if previously unchecked, the user is trying to set a password

            if (requireMasterPasswordCheckBox.Checked)
            {
                using (var enterPassword = new EnterMasterPasswordDialog(TemporaryMasterPassword))
                {
                    if (enterPassword.ShowDialog(this) == DialogResult.OK)
                    {
                        TemporaryMasterPassword = null;
                        requireMasterPasswordCheckBox.Checked = false;
                        changeMasterPasswordButton.Enabled = false;
                    }
                }
            }
            else
            {
                System.Diagnostics.Debug.Assert(TemporaryMasterPassword == null, "Master password is set, but not reflected on GUI");

                if (TemporaryMasterPassword == null)
                {
                    // no previous password existed => set a new one
                    using (var setPassword = new SetMasterPasswordDialog())
                    {
                        if (setPassword.ShowDialog(this) == DialogResult.OK)
                        {
                            TemporaryMasterPassword = setPassword.NewPassword;
                            requireMasterPasswordCheckBox.Checked = true;
                            changeMasterPasswordButton.Enabled = true;
                        }
                    }
                }
                else
                {
                    // a previous password existed (should never get here but just in case)
                    // enable button to facilitate password change
                    requireMasterPasswordCheckBox.Checked = true;
                    changeMasterPasswordButton.Enabled = true;
                }
            }
        }