コード例 #1
0
        private void btnGeneratePassword_Click(object sender, RoutedEventArgs e)
        {
            if (ClearBeforeGenerating)
            {
                Passwords.Clear();
            }

            var rnd = new Random();

            for (var i = 0; i < PasswordsToGenerate; i++)
            {
                var password = string.Empty;

                for (var j = 0; j < 11; j++)
                {
                    password += Convert.ToChar(rnd.Next(97, 122));
                }

                password = password[0].ToString().ToUpper() + password.Substring(1);

                password += rnd.Next(0, 9).ToString();

                Passwords.Insert(0, password);
            }
        }
コード例 #2
0
 private void btnClearPasswords_Click(object sender, RoutedEventArgs e)
 {
     Passwords.Clear();
 }