Finally got the new version of Product Key Manager done. Its getting late so I don’t have a lot of details right now, but if you are interested its up on CodePlex now.

I finally discovered the cause of deployment deadlocks with PKM 3, it turns out it was an issue with the same database file being used for development/debug as the ClickOnce deployed release version. I’m not completely sure why the deadlocks were occurring since I had no way of debugging it but clearing database and letting a new DB being created resolved the issues on my machine.
I’m going to make some changes to allow for version checking the database and different filenames for debug and release databases to avoid future issues. In attempts to resolve the issue I did implement some great improvements so I guess it wasn’t all bad. I’ll try to get a finalized version out soon.
I stumbled upon an interesting project today called Bindable LINQ which I have given the nickname BLINQ in the vain of DLINQ, XLINQ, PLINQ etc. What this does is make LINQ queries work with WPF binding, which really should be a part of LINQ to begin with but hey that's what happens. I haven’t used it too heavily but it works for basic LINQ queries, and has significantly reduced the number of queries and calls to the database I needed for Product Key Manager by using the WPF sorting and filtering capabilities rather than re-querying the database all of the time.
If you are using WPF and LINQ I’d recommend checking it out!
I haven’t forgotten about Product Key Manager, but I have been busy enough that I haven’t been able to sit down and verify its ready for release. There are a few potential issues that I need to sort out that might end up being more complex to fix than they seem. The big issue I have right now is a deadlock on the first launch after install, this has been tricky to debug since it occurs right after the application is launched by the ClickOnce installer only. This may be related to some phantom deadlocks that I had earlier that I can no longer reproduce.
If you are waiting on a new Product Key Manager release let me know so at least I know someone is waiting, otherwise I may end up doing a more drastic rewrite of the data access layer as that seems to be where the issues are coming from.
*Note* I typed this up while my internet access was down and posted it when it came back online.
Hopefully not but it certainly appears that way. I discovered this earlier today, can’t remember where I saw the first reference, and found a couple of great posts here and here. As someone who uses LINQ to SQL a lot with my personal projects this is very disappointing but it appears the writing is on the wall. As pointed out in this article about TDD with LINQ LINQ to SQL was always advertised in beta as being extensible so providers for other DBs could be created but it appears that this was removed in favor of SQL Server only at RTM.
I’ve always been a supporter of Microsoft but stuff like this is only going to add to the negative image they already have. The made something that was great and did its job well and at the last minute crippled it. Now LINQ to SQL has been moved to the same team in charge of the Entity Framework, which is definitely not finding favor with developers, which has left it for dead. Now the functionality that was originally in LINQ to SQL v1 (disabled not because of technical reasons, but political ones) is going to be included in to the Entity Framework which adds an overwhelming level of complexity that is not needed by the segment LINQ to SQL fits well.
If the ADO.NET team does kill off LINQ to SQL by ignoring it I definitely won’t be switching to Entity Framework unless they find a way to make it LINQ to SQL (quite an interesting thought huh). If you use or like LINQ to SQL let them know and just maybe they will listen.
I was recently in the need of a DataGrid for a WPF project and turned up this: http://www.codeplex.com/wpf. The WPF toolkit has, what appears to be, a WPF version of the Silverlight DataGrid (probably other differences). I haven’t gotten a change to really dig into the WPF toolkit but it certainly looks promising.
Yesterday I found out that there was a new firmware upgrade for my D-Link Router (DIR-655), something until now I had been happy with. When I got home from work I decided to upgrade, before it started the router warned me to backup the settings as the update may revert to default settings. That is fair enough, so I go ahead and backup the settings right away and then update.
Now I have plenty of experience with Netgear and Linksys routers and have never had a router update completely revert settings to factory defaults (including password). Sometimes there are sections that revert but generally things like passwords and IP reservations remain unchanged. This was unfortunately not the case, in fact the password was removed!
Fortunately I backed up the settings right? I mean D-Link told me that doing so would allow me to restore my settings if the upgrade wiped them out. Well sure enough it was unable to restore settings backed up by previous firmware. I find it very hard to believe that D-Link resets all settings and gives you no way of backing them up and restoring them. The real fun came up while I was trying to work from home this morning. Since I had setup a bunch of IP reservations I started having some serious trouble with conflicts and basically had to rebuild the network quickly this morning.
Long story short it was the worst firmware upgrade I have ever experienced with a router and it seriously turned me off to future D-Link products.
I was getting to the point where I was fairly sure I was ready to release an early beta but stumbled upon a deadlock so I’ll need to resolve this before I can get a release up.
My last post on WPF and Skinning seems to be a spam magnet. The comments on that post are like 600% higher than normal but they are all spam.... sheesh
Last night I presented for the Mankato .NET User Group on Windows Presentation Framework and a question came up about skinning. Programmatically changing styles in a way similar ASP.NET themes. This piqued my interest so I thought I would give it a try. My first attempt was to create a sample app that defined styles in C# and set by button handlers:
<Window x:Class="Themeing.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button Click="Button_Click">Style 1</Button>
<Button Click="Button_Click_1">Style 2</Button>
<Button Click="Button_Click_2">Clear</Button>
</StackPanel>
<TextBlock Name="myTextBlock" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center">Sample Text</TextBlock>
</Grid>
</Window>
The codebehind looks like this:
public partial class Window1 : Window
{
Style style1 = new Style(typeof(TextBlock));
Style style2 = new Style(typeof(TextBlock));
public Window1()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(Window1_Loaded);
}
void Window1_Loaded(object sender, RoutedEventArgs e)
{
style1.Setters.Add(new Setter(ForegroundProperty, Brushes.Green));
style1.Setters.Add(new Setter(FontWeightProperty, FontWeights.Bold));
style2.Setters.Add(new Setter(ForegroundProperty, Brushes.Purple));
style2.Setters.Add(new Setter(FontSizeProperty, 25.0));
}
private void Button_Click(object sender, RoutedEventArgs e)
{
myTextBlock.Style = style1;
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
myTextBlock.Style = style2;
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
myTextBlock.Style = null;
}
}
We create two styles (style1 and style2) which for the sake of this example target TextBlock. We then populated our styles. One style is Green and Bold and the other is Purple and pretty big. You will also notice we have three Button_Click handlers (I really didn’t spend the time with naming). The first handler sets myTextBlock’s style to style1 and the second sets it to style2. The third sets the style to null which is to return to no styling at all.
Once our little app loads we get this:
Style 1:
Style 2:
and finally Clear:
As you can see its pretty simple to set styles in codebehind but creating styles in C# is kind of a pain. In part 2 I’m going to try and change styles that are defined in XAML rather than in C#
I’ve been spending some of my free time on my Product Key Manager project and finally posted some screenshots on CodePlex. The next version will have quite a few changes affecting the UI, XML handling, and data access. I’m cleaning up the UI and attempting to match the host OS a little more. The old black and orange just felt too dark and out of place and wasn’t coded well. There was redundant XAML all over the place just defining the gradient that defined the black background. I’m also taking elements of the UI to the next level and making it much more interesting that just a list box.
I’ve been working on all of the C# code, from code behind to data layer and trying to make it better. I’ve also been running code analysis tools to improve the quality and performance of the code. This change also brings in .NET 3.5 SP1 and SQL Server Compact Edition (SSCE) 3.5 SP1 which will allow PKM to run with the ANYCPU flag rather than being forced to use the x86 flag which forces it to run in the 32-bit emulator on 64-bit Windows. Sure 64-bit gives us almost no advantage for this app, but that’s just the way I roll.
The major changes include a much lighter colored look, and moving from a ListBox style UI to one that is more like Explorer (WrapPanel is really cool!). The color change is more about making cleaning up the UI and using styles. Once I’m done the coloring will be defined once so it can be more easily changed. I’m also going to try and make it look more like the host OS more if possible.
This shows that the search similarity stuff is still there.
There are two new buttons on the Edit Dialog that allow you to set the icon and add notes to the product. Neither of these have been fully fleshed out yet so no screenshots yet.
I ran across a problem that took me nearly a week to solve in my Product Key Manager project. I was using some Vista icons from the Visual Studio 2008 Image library and was having really weird problems where some, but not all, icons would show up the first time but not a second time. I eventually stumbled upon this thread: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/bebf27e5-393b-4a8b-bd79-252215ebe095/.
This isn’t something limited to WPF, it affects WinForms as well, but Vista supports PNG icons but .NET does not yet support it. I had to open the icons in the Visual Studio icon editor and delete the 256x256 PNG icon, which isn’t a big deal because I wasn’t using them in that size but it would be nice if .NET 3.5 SP1 which came out after Vista included support for Vista icons.
So if you run into weird problems with icons in .NET make sure you don’t have an PNG format icons in the icon.
I bought a copy of Programming Windows Presentation Foundation by Chris Sells and Ian Griffiths around the time it first came out while WPF was still in Beta more than two years ago. I started reading it and at some point I got distracted and stopped reading it. I literally forgot I had it for two whole years as it was sitting on my bookshelf. I'm guessing I got busy and took a break from reading it and ended up with Petzold's book and Nathan's RTM based WPF books and just relegated it to the beta book section (In fact it was sitting next to my codename Indigo book) without realizing that it was the Sells/Griffiths book.
After some WPF based conversations at the Mankato .NET User Group and agreeing to do a WPF presentation I took a second look at it and was pleasantly surprised to discover which WPF book it was. I started re-reading and I'm disappointed I never found time to finish it earlier. It is in my opinion one of the best books, especially for people wanting to dive in to WPF. I really do like it that much.
It is a beta book though and I did notice some things that hand changed since the book was published, heck it even said AKA Avalon on the cover. I wondered if there was a second edition of the book that had been updated since RTM so while at the bookstore tonight I decided to take a look and boy is there. The second edition is about twice as thick as the first edition! Including the index the first edition comes to a mere 430 pages while the second is a heavy, by contrast, 834 pages with index.
There are a lot of great new chapters on Input (Mouse, Keyboard, Ink and Commands), a dedicated chapter on NavigationWindow and XBAP applications, Text and Flow documents, Printing/XPS, 3D, and more. There are also a couple new appendices including one on Silverlight. I would definitely say that this is a must have book for WPF developers and a great starter book for new WPF developers.
I was messing around with the Zune software today and stumbled upon a really cool view while listening to some music.

Using cover art for the background is pretty sweet. I kind of wish that I could have this type of thing as the background on all screens not just the playing screen.
I always thought the original XamlPad was a cool tool, at the time I was using it WPF was still in beta and Visual Studio 2005 didn't really have designer support. I lost track of the tool sometime after .NET 3.0 was released, and honestly I don't know if its still available if you download the Windows SDK. All I know is that a full install of Visual Studio 2008 Team System Edition does not appear to have it. Well it turns out someone else has created a similar tool (named XamlPadX) and has even made it to version 4 without me noticing (XamlPadX 4.0).
Next page »