13. July 2005 08:54
My entry into our little “Iron Coder” competition
is up on Project Distributor
. After Darren's entry explored the observer pattern
with a nicely factored interface for “secure” controls I thought there wasn't much left for me to say in that direction. Instead I tried to do the simplest thing that would work - sub-classing the tab-page control, adding a roles property and ensuring the tab-page was not displayed (by removing it form the parent tabstrip's tabpages collection). This resulted in some pretty compact (but ugly) code. I then added a “secure button” control (which was much more straightforward, and helped me to factor out the common role-checking code) to show that the tab-strip is a more-complicated-than-usual case because it does not properly honour the visible property. In a real project I think I'd create an interface like Darren did, but it was un-necessary for this simple example. “Chairman” Mitch
says once I post this we can move on to the next round - whatever that is. I wonder if he will be able to get a japanese starlet, a writer and a food critic to review our code (ala Iron Chef)?