The Blog of Zachary Snow

Using Component Glue to build your object graphs automatically

Component Glue is an IoC container and you use it of course to wire up your object graphs for you. Component Glue can also build your object graphs for you automatically if there are no interfaces involved. Take this example:

In After.cs, you can see that Component Glue is able to build the entire object graph for us. This will include all future dependencies as well so long as interfaces don’t come into play. Should an interface be needed, you can just bind that single component.

This is a very powerful thing. If one component needs to take on a dependency, just ask for it in the constructor and Component Glue will handle it for you.

Component Glue v1.0

I finally brought Component Glue up to a state where I felt like the product was finished. You can get it via NuGet:

PM> Install-Package ComponentGlue

or you can get the source from GitHub. The documentation is definitely sparse I know but I recommend taking a look at the unit tests to get a feel for what you can do with Component Glue.

Credit for the NuGet CSS here.

GLDotNet Version 0.6.0

I just released GLDotNet Version 0.6.0.

Changelog:

  • **GLDotNet.Toolkit**: Assembly containing simple app framework.
  • **GLDotNet.Objects**: Assembly containing higher level objects such as Texture2D and VertexBuffer.
  • More overloads added to GLContext class.
  • byte and sbyte are now mapped correctly in generated code.
  • Fixed the naming of some functions so as not to include type notation, i.e. Color4u.
  • Decreased the number of enum values output.

Introducing GLDotNet

Today I released a project I’ve been playing around with for a year or so on Codeplex. It’s called GLDotNet. From the project description:

C# wrapper for OpenGL. Partially generated from the OpenGL spec and partially written by hand, the aim is to have a flexible and native feeling C# binding.

I have generated functions from the OpenGL spec excluding 1 or 2 but unfortunately of the generated code is untested. There is a demo project included in the source code. The Github repository is located here: https://github.com/smack0007/GLDotNet

GLDotNet

Getting Started with Snowball

My game framework Snowball is far enough along that small games can be developed with it by now. The basic overall design is now laid out and not too much is likely to change as I’m now developing my own small games with it.

In order to create some kind of documentation on how to use Snowball, I created a Samples folder in the source. In the Samples folder is a WalkingWizard sample. I’m posting this source code here but it can also be viewed on GitHub here.

WinQuakeCon

I’ve always wanted a program that would allow me have a command line that I could slide in and out of view as needed like the console from Quake). I never could find one and so I finally got decided to write a tool myself. A picture is below and the source code is on GitHub.

I’m not putting a download here as I don’t consider this finished just yet.

Zune Playlist / SMIL Copier

I needed a tool that would copy the contents of a Zune playlist to a given directory. I did a bit of googling and I couldn’t find anything, so like any good nerd I wrote a tool that did.

SMILCopier

The format of Zune playlists is a simple XML format known as SMIL. I think Windows Media Player also stores playlists in this format but I haven’t confirmed that yet.

I wrote the tool very quickly and have only tested it on my machine with my test data, but I’ll provide the source if you’d like to modify for yourself. The source is C#.

Download Executable Download Source

Implementing basic Dependency Injection using a Service Container

By extending your Service Container class, a very basic version of dependency injection can be implemented. We’ll implement two forms of dependency injection: constructor and property injection.

Progress Bar in Windows 7 Taskbars

I decided to add progress bar to the Windows 7 Taskbar in my Timer app.

I started by downloading and compiling the Windows API Code Pack in Release mode. I then added a reference to the Microsoft.WindowsAPICodePack.dll and Microsoft.WindowsAPICodePack.Shell.dll files to the project. After that add the lines:

using Microsoft.WindowsAPICodePack.Taskbar;

to your using statements. When the clock starts running I create the progress bar in the taskbar with:

// Initialize progress bar
if(TaskbarManager.IsPlatformSupported)
{
    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);
    TaskbarManager.Instance.SetProgressValue(0, (int)this.totalTime.TotalSeconds, this.Handle);
}

to stop the progress bar:

// Stop progress bar
if(TaskbarManager.IsPlatformSupported)
    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);

and finally to update the progress bar on each tick:

// Update progress bar
if(TaskbarManager.IsPlatformSupported)
    TaskbarManager.Instance.SetProgressValue((int)this.totalTime.TotalSeconds – (int)this.time.TotalSeconds, (int)this.totalTime.TotalSeconds, this.Handle);

Download Binary Download Source