This application is part of the author's "30 Days of .NET" initiative to develop 30 mobile applications in 30 days. The source code of the application is included in order to help programmers new to Windows Mobile development write applications in .NET.
I had a couple submissions for ideas to use in today's application, but decided I would use one of my own. My idea is a simple yet very useful application for generating random passwords.
Nothing too fancy here. It's a good looking application, but it didn't take much to make it so. Just clean layout and simple design. I did add a horizontal ruler line between the inputs and the outputs. It is actually two panels set to 1 pixel high each with ones back color set to light blue and the other pure white. The form's background is just a little off-white to add some warmth, but it is hard to tell directly.
The application engine is also clean and simple. There is a password class that has properties for each of the options, and there are two methods: Generate, and ConvertToPhonetic.
I have four character groups:
static string lowerCase = @"abcdefghijklmnopqrstuvwyxz";
static string upperCase = @"ABCDEFGHIJKLMNOPQRSTUVWYXZ";
static string numbers = @"0123456789";
static string punctuation = @"~!@#$%^&*()-+='"",.?";
Based on options the user chooses a character list is created with all possible characters for the user's password.
Next I GeneratePasswordLength worth's of characters for the password.
This is very important. I use RNGCryptoServiceProvider to generate a random seed number for the random number generator. We want real random numbers, not wishy-washy random numbers. This is a good source for how to use Crypto providers to make a password generator.
Pretty cool code, so check it out if you haven't ever generated random numbers before.
I pulled the Phonetic Alphabet off Wikipedia and made it into a generic dictionary object.
Lastly, I added a menu item that allow users to copy the password to their clipboard. I had to write some code to copy text into the clipboard. This is the best code I could find for doing so.
BTW, there is a bug in the screenshot. Fixed in the current release. Can you see it? It's subtle. It has to do with the handle the last character. Good luck finding it.
· .NET Compact Framework