Wednesday, June 11, 2008

I mentioned to the group that I would post the Prize Picker application we wrote together on my blog as part of my 30 Days of .NET series. I think this was an awesome idea, and it looked like everyone really enjoyed themselves. Hopefully, a few of them will see this post and share their thoughts as well. It was very nice to have a hands on type presentation that everyone got to participate in together. And since only one person was “driving” we didn’t have to stop and fix a disconnected monitor. Ok, we did one time, but just one time. Open-mouthed 

Big thanks to everyone that came out and participated! Page Brooks, Donny Craft, Benton Little, , Jamey McElveen , Shawn Morris, and Thad Smith. It was a lot of fun!

 

PrizePicker

Prize Picker

There is probably someone out there who doesn’t think this is the best looking application ever. Well, you’re right! It’s not, but we didn’t really focus on that any until we had a fully functional application. At that point it was time to pick prizes for the lucky hopefuls that became winners at the event.

The only big item we didn’t implement, was an item that came up right at the end, we wanted to show the last winner in the area down at the bottom of the screen in big blog letters. And we wanted to rotate through remaining hopefuls and then finally pick a winner moving them to the winners table.

The application is a firm believer of the KISS principle. We did the entire application in about an hour and a half. And that is including some refactorings, and changes we made along the way. I’m pretty happy with the application, and will love it once we have the “Jackpot” style UI element added.

We added validation as we needed it, and decided to keep the applications logic in the UI, as hard as it was for us to do, to in this case to follow our KISS guidelines.

We have used RNGCryptoServiceProvider class already in the Pocket PasswordGen application on day six. This class makes sure that our random numbers are statistically random and not pretend watered down random.

   1: Byte[] randomBytes = new byte[4];
   2:  
   3: RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
   4: rng.GetBytes(randomBytes);
   5:  
   6: // Convert 4 bytes into a 32-bit integer value.
   7: int seed = (randomBytes[0] & 0x7f) << 24 |
   8:             randomBytes[1] << 16 |
   9:             randomBytes[2] << 8 |
  10:             randomBytes[3];
  11:  
  12: int pick = seed % listViewHopefuls.Items.Count;

 

Download executable: prizePicker.cab

Download Source Code: prizePicker.zip

Feedback

The cool thing is we used this application to actually pick the winners for the prizes, and everything went great. So our intention is to keep using it from now. We are also going to post it on CodePlex soon and allow others to work on it as well.


Wednesday, June 11, 2008 2:55:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |  Trackback Tracked by:
"30 days of .NET for Windows Mobile" (Alex Yakhnin - Mobility Consultant, Former... [Trackback]

Comments are closed.

Theme design by Jelle Druyts

Pick a theme: