コード例 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string Username   = txtUsername.Text;
            string Password   = txtPassword.Text;
            bool   rememberMe = chkRememberMe.Checked;

            for (int i = 0; i < UserList.Count; i++)
            {
                User user = UserList[i];
                if (user.IsValid(Username, Password))
                {
                    user.RememberMe1          = rememberMe;
                    lblLoginMessage.Text      = "Success";
                    lblLoginMessage.ForeColor = Color.Green;
                    LoginedUser.getInstance().User = user;
                    LoginDelay.Start();
                    if (rememberMe == true)
                    {
                        Util.SaveCsv(UserList, UserFilePath);
                    }
                    MainWindow.username = Username;
                    MainWindow.password = Password;
                    MainWindow.index    = i;
                    Util.LoadCsv(User.phones, Phonebook.PhonebookFilePath, Username);
                    return;
                }
                lblLoginMessage.Text      = "Failure";
                lblLoginMessage.ForeColor = Color.Red;
            }
        }
コード例 #2
0
        private void checkRememberedUser()
        {
            int i = 0;

            foreach (User user in UserList)
            {
                if (user.RememberMe1)
                {
                    MainWindow.index = i;
                    LoginedUser.getInstance().User = user;
                    LoginDelay.Interval = 10;
                    LoginDelay.Start();
                    return;
                }
            }
        }