These are my links for February 20th:
These are my links for February 10th:
Now that we’ve successfully demoed the Wiimote visualizer in the Open Space at MIX 08 and shown off what we can do at the Show Off event, I need to be a responsible blogger and put the project up… files and all. I have, with Brian Peek’s permission, packaged his managed library in here as well. Please read and respect his licencing agreements.
WPF Wii Binding Library (dlls only)
WPF Wii Binding Library (source)
There are really two parts to the WPF Wiimote Visualizer. The first part is the WPF Wiimote Binding Library, which we’ll cover in this post (or at least make this post the hub of that information). The second part is the Visualizer program itself, which is basically just the WPF Wiimote Library bound to a bunch of XAML elements.
The WPF Wiimote Binding Library will allow simple binding between your Wiimote and your WPF application (I’ve got a whole post on that here). But let me extrapolate a little on what the library has to offer. I’ve seperated out the data into different posts to make it a little more digestible.
Infrared Data
Button Data (coming soon)
Misc Data (Rumble, Battery, Accelerometers) (coming soon)
Nunchuk Data (coming soon)
(I’m getting to the point in a roundabout way… you can skip directly to the point below if you want.)
When I started working on my WPF-Wii tutorials, my first Wii project was the initial version of the WPF-Wii Visualizer.
However, I quickly got tired of writing the code for handling events and transferring the data from the Wiimote library to my application. So (like any noble geek would do) I wrote even MORE code to solve the problem, not only for myself, but for generations to come.
I’ve spend the last week writing a Wii-To-WPF library that shovels the Wiimote properties into properties that use the INotifyPropertyChanged WPF interface. This will allow anyone to connect to the Wii through the WPF data binding. It’s super cool.
(A point of note, I posted an early version of this library. Ignore it. I’m putting up a much improved version in the next couple days.)
The Point
But I had no idea how moving from a basic data transference and event handling to the INotifyPropertyChanged interface would affect my performance.
Here are some screenshots of Perforator (a WPF performance monitoring application) monitoring my WPF-Wii Visualizer in its code-heavy iteration:

I don’t know what all those numbers mean, but the one I’m interested in is the frame rate. As a designer, smoother motion is good… especially if I’m trying to design a multi-point application. A frame rate of 27 isn’t too bad, but this is the best I got. The frame rate usually hovered around 20, dipping as low as five.
Now… this is what I got when I was binding the data through the XAML (absolutely no code whatsoever):

And this was the worst I got. My frame rate was always in the mid 60s and would spike up to 80. Take note that I’m not changing the interface at all. In fact, I’m running the binding version at a handicap (it’s tracking four infrared points instead of the original two).
Exact same XAML … except that the XAML properties are data bound from within the XAML and not assigned via the C# code.
So, lets take an account of the WPF INotifyPropertyChanged interface:
- Allows DataBinding
- Permits code-light or code-free interface design
- Drastic improvements to performance
Use it!
Enough said.