예제 #1
0
        private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            switch (MessageBox.Show(this, "Would you like to save before you quit?", "Closing", MessageBoxButtons.YesNo))
            {
            case DialogResult.Yes:
                FileIo.saveCredentialToEncryptedFile(credentials);
                break;

            default:
                break;
            }

            Hide();
            credentials = null;
            frm_LogIn frm_LogIn = new frm_LogIn();

            frm_LogIn.FormClosed += (s, args) => Close();
            frm_LogIn.Show();
        }
예제 #2
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
            if (e.CloseReason == CloseReason.WindowsShutDown)
            {
                return;
            }

            // Confirm user wants to close

            switch (MessageBox.Show(this, "Would you like to save before you quit?", "Closing", MessageBoxButtons.YesNo))
            {
            case DialogResult.Yes:
                FileIo.saveCredentialToEncryptedFile(credentials);
                break;

            default:
                break;
            }
        }