private SecureString GetPattern() { using (frmPatternLock form = new frmPatternLock(settings)) { return(form.ShowDialog(this) == DialogResult.OK ? form.GetPattern() : null); } }
private void mnuLockUnlock_Click(object sender, EventArgs e) { using (frmPatternLock form = new frmPatternLock(settings)) { DialogResult result = form.ShowDialog(this); if (result == DialogResult.OK) { if (settings.EncryptionMode == EncryptionMode.Pattern) { try { // Perform unlock settings.SetPattern(form.GetPattern()); settings.Unlock(); AddAccounts(); mnuLockUnlock.Visible = false; mnuAddAccount.Enabled = true; } catch (CryptographicException) { MessageBox.Show("Invalid Pattern"); } } else { // Perform first lock mnuLockUnlock.Visible = false; settings.SetPattern(form.GetPattern()); settings.SaveAccounts(); } } settings.SaveSettings(); } }