Exemplo n.º 1
0
        void CreateNewUser(UserFile userFile, string message)
        {
            var passwordForm = new FormPassword();

            passwordForm.Message = message;
            passwordForm.ShowDialog(this);
            if (!passwordForm.Accepted)
            {
                return;
            }

            var user = userFile.Find(passwordForm.UserName);

            if (user != null)
            {
                MessageBox.Show(this, "This user already exists", App.Name);
                return;
            }

            // Create and save new user
            user          = new User();
            user.UserName = passwordForm.UserName;
            user.ResetPassword(passwordForm.Password);
            userFile.Users.Add(user);
        }