DotNetSlackers: ASP.NET News for lazy Developers

Friday, January 7, 2011

A better way to organize your Silverlight Code Snippets


I hate re-writing code. I also hate it when I find a great code snippet on the web and forget to bookmark it or it gets lost in my endless sea of bookmarks. So what do you do to get around this? This is the question that I was asking myself at the end of 2010. How can I get my Silverlight code organized?
My requirements for a snippet manager were:
  1. Needs to be FREE.
  2. An easy way to view XAML/C# code behind together in one “view”.
  3. I wanted the ability to store the code snippets in cloud in case my HDD dies.
  4. Searchable Keywords to quickly find code snippets.
I started looking for a snippet manager that would allow me to do just that and finally found Snippet Manager.
Before going any further, I think that one of the most important things to note here is that this software supports 37 languages. It’s not just for Silverlight developers nor C# only guys. The software supports Java, SQL and even COBOL.
image
Below is a screenshot of the Snippet Manager that shows my Silverlight code snippet. You will notice that I have highlighted two sections. The top part is my XAML and the bottom is my C# code behind.
SNAGHTML18dc4471
I've included a sample below of my code snippets so that you can get an idea of how I organized it. Another thing that’s great about this software is that it supports plain text. I added some connection strings in the TEXT section below. 
image
Once you have finished adding your code snippets, you can store them in the cloud. I created a FTP directory called “snippets” on my FTP Server and hit the upload button once I am finished adding my new code snippets. This will allow me to use the code snippets on another computer with this application on my USB Key. See screenshots below:
Enter your FTP credentials below:
SNAGHTML1906f846
Hit the Uploads button on the Toolbar:
image
Login to your FTP Server and verify the following files are now on the FTP Server:
image
Another great feature of the Snippet Manager is that you can also integrate this into VS2010 by clicking Tools –> External Tools:
image
And setting up your External Screen to point to the Executable:
SNAGHTML190df71d
You can now launch it by going to Tools –> Snippet Manager. If you want, you could also use a shortcut to launch the program with HotKeys.
image
As you can see, this is a nice little program that includes everything needed to organize your code snippets very clean. I didn’t go over every feature, but this is something that you might want to download and give it a shot.

No comments:

Post a Comment