예제 #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SharedObject.passwordGood       = false;
            SharedObject.generatedPassword  = "";
            SharedObject.newCredentialAdded = false;

            // Password file exists, so user is asked to enter password instead
            if (File.Exists(Properties.Settings.Default.DatabaseFilename))
            {
                CheckPasswordForm checkPasswordForm = new CheckPasswordForm();
                checkPasswordForm.ShowDialog();
                this.Hide();
            }
            // Show the password-entry form to the user if this is the user's first time
            else
            {
                NewPasswordForm newPasswordForm = new NewPasswordForm();
                newPasswordForm.ShowDialog();
                this.Hide();
            }

            // The password was good, so activate everything on the form
            if (SharedObject.passwordGood)
            {
                // Set idle watch
                Application.Idle += new EventHandler(Application_Idle);

                ActivateMainForm();
            }
        }
예제 #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CheckPasswordForm checkPasswordForm = new CheckPasswordForm();

            checkPasswordForm.ShowDialog();

            if (SharedObject.passwordGood)
            {
                ActivateMainForm();
            }
        }
예제 #3
0
        public void UnlockMainForm()
        {
            CheckPasswordForm checkPasswordForm = new CheckPasswordForm();

            checkPasswordForm.ShowDialog();

            if (SharedObject.passwordGood)
            {
                this.Text = "Password Manager";
                lockToolStripMenuItem.Text = "&Lock";

                ActivateMainForm();
            }
        }
예제 #4
0
        public void LockMainForm()
        {
            DeactivateMainForm();
            SharedObject.passwordGood = false;
            SharedObject.encryptedPassword.Clear();

            this.Text = "Password Manager (Locked)";
            lockToolStripMenuItem.Text = "&Unlock";

            CheckPasswordForm checkPasswordForm = new CheckPasswordForm();

            checkPasswordForm.ShowDialog();

            if (SharedObject.passwordGood)
            {
                this.Text = "Password Manager";
                lockToolStripMenuItem.Text = "&Lock";

                ActivateMainForm();
            }
        }
예제 #5
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!UserDataIOManager.LoginDataExists)
            {
                new NewPasswordForm().ShowDialog();
            }
            else
            {
                UserDataIOManager.LoadCryptoRNGData();
            }
            CheckPasswordForm CheckPWForm = new CheckPasswordForm();

            CheckPWForm.ShowDialog();
            if (CheckPWForm.LoggedIn)
            {
                Application.Run(new MainForm());
            }
            else
            {
                Environment.Exit(0);
            }
        }