When your product manager checks code into your source control project, it means one of three things:
- Your engineering team is short-handed.
- Your project is really in trouble.
- Your development environment is really, really easy to use.
While I’m not sure that #2 isn’t true, I found #3 to be absolutely true working on a recent software release with my team. We’re using the Windows Presentation Foundation, aka Avalon, and I used Microsoft’s Expression Blend to make the project’s About window.
WPF is designed to enforce separation of code and presentation, and tools like Expression Blend enable that. The presentation markup enabled me to automatically include the current assembly information (version number, product name, copyright string), plus free memory information, and even a little animation.
The trick was in learning how to do data binding. I specified various modules of the .NET Framework as data sources, then bound text objects to methods in the framework. Interestingly, the easiest way to get assembly information was in the Microsoft.VisualBasic.ApplicationServices namespace, in a class called AssemblyInfo; of course it doesn’t matter since the same code can be accessed by any .NET compatible language, including C#. The only challenge came in showing the available memory, since the methods in Microsoft.VisualBasic.Devices.ComputerInfo return memory in bytes. I wanted to show the information in megabytes, so I attached some simple C# code as a converter to represent the information in megabytes and format it appropriately for the user’s region.
Like I said: simple.