Blog Home  Home Feed your aggregator (RSS 2.0)  
.Net Jonesie - Me Too Snippets
A simple programmers blog
 
# Wednesday, February 15, 2006
I'm jumping on the snippet bandwagon a bit late but this morning I realised I was repeating myself repeating myself repeating myself more than usual.  I am trying to figure out a bit of spaghetti I write a while ago that is getting events firing in the wrong order.  The logic is  bit too complex to step through so I'm adding tracing code and capturing this to a log file. 
 
Eg:
 

    1     private void fireModeChange()

    2     {

    3       Trace.WriteLine("Starting fireModeChange", "Designer");

    4       Trace.Indent();

    5       try

    6       {

    7         if (ModeChanged != null)

    8         {

    9           ModeChanged(this, new EventArgs());

   10         }

   11       }

   12       finally

   13       {

   14 

   15         Trace.Unindent();

   16         Trace.WriteLine("Ending fireModeChange", "Designer");

   17       }

   18     }

 
The time saving solution is to create a code snippet that surrounds the selected code with this block.  Creating a snippet is pretty easy when you've done it a few times, but to make things interesting I downloaded Snippy from GotDotNet.  It's a NLU (nice little utility) for creating snippet files.
 
 
Now surrounding the selected code is very easy.  Of course, it's taken me several hours of fracking about to get all this working and documented - but that's another blog post :}
Wednesday, February 15, 2006 12:01:20 PM (New Zealand Daylight Time, UTC+13:00)  #    Comments [0]   Visual Studio  | 
Comments are closed.
Copyright © 2012 Peter G Jones. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: