示例#1
0
 private SecureString GetPattern()
 {
     using (frmPatternLock form = new frmPatternLock(settings))
     {
         return(form.ShowDialog(this) == DialogResult.OK ? form.GetPattern() : null);
     }
 }
示例#2
0
        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();
            }
        }
示例#3
0
        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();
            }
        }