Пример #1
0
        private void doForgetMe()
        {
            DialogResult shouldLogout = MessageBoxHandler.ShowUserMessageBoxWithResponse("Are you sure you want to be forgoten? \n next time you use the app you will need to connect again", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (shouldLogout == DialogResult.Yes)
            {
                m_AppSettings.DeleteAppSettingsFile();
                m_AppSettings.RememberUser = false;
            }

            MessageBoxHandler.ShowUserInformationMessageBox("You where forrgoten!", "Success!");
        }
Пример #2
0
        private void LogOutButton_Click(object sender, EventArgs e)
        {
            DialogResult shouldLogout = MessageBoxHandler.ShowUserMessageBoxWithResponse("Are you sure you want to log out?", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (shouldLogout == DialogResult.Yes)
            {
                m_AppSettings.DeleteAppSettingsFile();
                m_AppSettings.RememberUser = false;
                m_TryingToLogout           = true;
                this.Hide();
                LoginForm loginForm = new LoginForm();
                loginForm.Show();
            }
        }
Пример #3
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            base.OnFormClosing(e);
            if (!m_TryingToLogout && !e.CloseReason.Equals(CloseReason.ApplicationExitCall))
            {
                DialogResult userWantToExit = MessageBoxHandler.ShowUserMessageBoxWithResponse("Are you sure you want to exit?", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (userWantToExit == DialogResult.Yes)
                {
                    if (m_AppSettings.RememberUser)
                    {
                        saveUserSettings();
                    }

                    Application.Exit();
                }
                else
                {
                    e.Cancel = true;
                }
            }
        }