Quick and Easy Google (or Bing) Web Search in Visual Studio

Here is a quick and easy way to add a Google (or Bing) Web Search link to the context menu in Visual Studio:

  • Open the Visual Studio macros IDE by navigating to Tools –> Macros –> Macros IDE (or pressing Alt+F11).
  • Right click on “MyMacros” and select Add New –> Add New Item.
  • Select the Module template, name the module “Search”, and click Add.
  • Paste the following code directly before the “End Module” line:
    Sub Search()
        Dim strUrl As String
        Dim selection As TextSelection = DTE.ActiveDocument.Selection()
        If selection.Text <> "" Then
            strUrl = "www.google.com/search?q=" + selection.Text
            'strUrl = "www.bing.com/search?q=" + selection.Text
            DTE.ExecuteCommand("View.URL", strUrl)
        Else
            MsgBox("Select Text first to Search")
        End If
    End Sub
    
  • (Optional) If you prefer to use Bing for your search, uncomment the Bing line and comment out the Google line.
  • Your macro editor window should now look something like this:
    image
  • Save and close the Macro Editor window and IDE.
  • Right click on the Visual Studio toolbar and select Customize.
  • Under the Toolbars tab, check the Context Menus option and the switch to the Commands tab.
  • Select the Macros Category, and then select the “MyMacros.Search.Search” macro.
  • Drag the selected macro onto “Editor Context Menus” -> “Code Window” and then drop it where you want it in the context menu (I place mine below the Paste command).
  • Right click on the new context menu item and change it’s name to “&Web Search”.
  • Click close on the Customize window.
  • You are now done! If everything has gone according to plan, when viewing a source code file you should now see a new context menu item that will do a web search on any selected text when you click it:
    image
    image
    • email
    • DotNetKicks
    • Digg
    • del.icio.us
    • Technorati
    • StumbleUpon
    • LinkedIn
    • Facebook
    • Twitter
    • Google Bookmarks
    • Live

Automatically Cancelling a Failed Build in Visual Studio

Stumbled across this little tip on how to automatically cancel a build in progress after getting an error. You normally have to wait for visual studio to try to finish building all of the remaining projects before getting a chance to fix an the issue and this can take a few minutes if you have a lot of projects in your solution.

Step 1: Open the Visual Studio macros IDE by navigating to Tools –> Macros –> Macros IDE.

Step 2: Double click on “MyMacros” and then on “EnvironmentEvents”. You should now be looking at a VB code editor window.

Step 3: Paste the following code directly before the “End Module” line:

Private Sub BuildEvents_OnBuildProjConfigDone(ByVal Project As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone

    If Success = False Then
        DTE.ExecuteCommand("Build.Cancel")
    End If

End Sub

Step 4: Save and close the Macro Editor window and IDE.

All done!

  • email
  • DotNetKicks
  • Digg
  • del.icio.us
  • Technorati
  • StumbleUpon
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live

WPF / Silverlight Links

09/15/2009 – Edit: I now have a static page dedicated to these links.

I’m just starting go through my WPF books, so I wanted to capture some useful WPF / Silverlight links that I’ve discovered over the last year.

Windows Client – Winforms and WPF Home. Information, tutorials, links.
http://windowsclient.net/default.aspx

Silverlight Home – Information, tutorials, links.
http://silverlight.net/default.aspx

Web Platform – Microsoft Web Platform Information. Web Platform Installer download.
http://www.microsoft.com/web/default.aspx

Codeplex WPF Home – Portal for accessing the WPF Toolkit and the WPF Futures releases.
http://www.codeplex.com/wpf

WPF Toolkit – Additional Controls, Themes, and Tools for WPF.
http://wpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29117

Silverlight Toolkit – Additional Controls, Themes, and Tools for Silverlight.
http://silverlight.codeplex.com/

Patterns and Practicies: Composite WPF and Silverlight (Prism) – WPF /Silverlight Application Framework and Patterns.
http://compositewpf.codeplex.com/

Caliburn – WPF / Silverlight Application Framework.
http://caliburn.codeplex.com/

Visifire – Free (for GPL’d works) Silverlight and WPF Charting Controls. Has dual licensing model for closed source usage.
http://www.visifire.com/

Kaxaml – Lightweight XAML Editor.
http://www.kaxaml.com/

WebAii – Free Web Application Testing Framework for IE and Firefox. V2 Will support Silverlight.
http://www.artoftest.com/products/webaii.aspx

Ninject – Fast, Lightweight .Net Dependency Injection
http://www.ninject.org/

  • email
  • DotNetKicks
  • Digg
  • del.icio.us
  • Technorati
  • StumbleUpon
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live

Positive Feedback Systems in Line of Business Applications

Last week I was having one of those “what if” conversations with a coworker regarding our application and I mentioned jokingly that we should add an achievement system into the app, kind of like Xbox or StackOverflow. The more I thought about it, the more I started asking myself, why *don’t* businesses consider this kind of functionality for applications? I know there are always time and resource pressures for software projects which might make the priority of such a feature float to the bottom of any project teams task bucket, but there may be something more to this. If you figure that the average end user is stuck using the same set of software on a daily basis to complete their work day after day, adding features to business applications that actually reward them in subtle ways for being productive and make using the software more fun may not be so superfluous after all.

I’ve heard that it’s not uncommon for sales teams to have “scores” and leader boards to encourage friendly competition among the various members of the team, why shouldn’t business software contain similar concepts if the data allows it? The fun part is, such a system would be relatively trivial to implement with the average data set that a line of business application collects about user activity. Maybe you just made $10,000 in sales today, how great would it be if your CRM application rewarded you with a little badge to display on your user profile?

  • email
  • DotNetKicks
  • Digg
  • del.icio.us
  • Technorati
  • StumbleUpon
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Live

.Net Developer News & Downloads