Wednesday, March 23, 2011

Gist4u2 - NuGet Console Utilities for Gists

Not many people know this, but I'm actually a powershell ninja from waaayyyy back 

Scriptinggames2007

(that's me in the scoring list, third from the top)

So when I first started playing around with the NuGet Package Manager Console I was quite impressed with the opportunities it presented.

Flash forward to today and I'm preparing for a presentation in an upcoming Chicago Hackatopia Win Phone 7 event where I find myself storing a lot of my code snippets for my presentation in Gists.  That's when I got the idea for Gist4u2; a handy way to insert gists into your code.  

So far, it's been pretty useful for my demonstrations.  Here is a quick example of how I use it.  Let's say I'm starting a new Windows Phone 7 project and I want to add some basic MVVM fundamental code like a ViewModelBase and Commanding classes (DelegateCommand, EventToCommand behavior).

Start a new Win Phone 7 Project, Open the Package Manager Console from the Tools -> Library Package Manager Menu (if you don't have it, Install NuGet through the extension manager)

Packagermanagerconsole

Next, install the Gist4u2 package to add the helper commands into the Console

Install-list-gists

Notice the last Gist there, the 883810, that's what I want.  So I create a new file (hopefully in the future I can create them for you in the project) called MVVMCommon and type Gist-Insert '883810' to insert the contents of my MVVMCommon Gist.

Gist-insert

Bam!  That's it.  Now we have a ViewModelBase and DelegateCommand ready to use in our Windows Phone 7 project.  Now my presentation is going to be much quicker.

No comments:

Post a Comment