Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Helping others become Visual Studio Keyboard Ninja's with the Code Ninja Spy

Imagine you're a Visual Studio Keyboard Ninja. Your hands never leave it, you disdain the mouse and just let your fingers fly.

Now you're at the podium presenting, or paired with another, or giving a screencast, fingers flying as usual. Then the questions start flooding in... "How'd you do that?" "What made that happen?" "What shortcuts are you using?" "Where'd you learn that..." "What was that keyboard cord combination again?" etc. etc. etc.

Your train of thought is getting derailed, you're stumbling now, you are having the verbally repeat each action, your presentation is grinding to a halt and worse of all you realize you might not be imparting what you meant too, you're not building and sharing your hard won knowledge and experience with your audience.

If only there was some kind of keyboard shortcut visualizer. Something that visualized the keyboard shortcuts you're using so everyone can see what your hitting and follow along.

Something like...

Code Ninja Spy

image

This tool loads all Visual Studio shortcuts. When you press one, the key combination and the Visual Studio command will be displayed. So you can look over the shoulder of a skilled co-worker and learn from him the shortcuts he uses.

Start it via View -> Other Windows -> CodeNinjaSpy

The last 3 shortcuts are shown. If you have any suggestions, feature requests or find bugs, contact me via Twitter (@papaMufflon) or via GitHub, where this piece of software is available also (http://github.com/PapaMufflon/CodeNinjaSpy).

So not only only is this cool, but this wouldn't be a Coding4Fun blog post unless there was some code to share... 

The source for this tool is fully available for you to check out.

Here's a snap of the Solution:

image

SNAGHTML2db90473

And a quick code snip;

private static string ConvertToKeyBinding(List<List<Keys>> keyCombinations)
    {
      var keyBinding = "";

      foreach (var pressedKeysParameter in keyCombinations)
      {
        var pressedKeys = pressedKeysParameter.Select(k => k); // just copy
        var singleKeyBinding = "";

        // first ctrl
        if (pressedKeys.Any(IsControlKey))
        {
          singleKeyBinding = "ctrl+";
          pressedKeys = pressedKeys.Where(k => !IsControlKey(k));
        }

        // then shift
        if (pressedKeys.Any(IsShiftKey))
        {
          singleKeyBinding += "shift+";
          pressedKeys = pressedKeys.Where(k => !IsShiftKey(k));
        }

        // then alt
        if (pressedKeys.Any(IsAltKey))
        {
          singleKeyBinding += "alt+";
          pressedKeys = pressedKeys.Where(k => !IsAltKey(k));
        }

        singleKeyBinding = pressedKeys.Aggregate(singleKeyBinding, (current, pressedKey) => current + (KeyToString(pressedKey) + "+"));
        singleKeyBinding = singleKeyBinding.Substring(0, singleKeyBinding.Length - 1);

        keyBinding += singleKeyBinding + ", ";
      }

      return keyBinding.Substring(0, keyBinding.Length - 2);
    }

If you're looking to extend your knowledge of building Visual Studio Extensions or the keyboard command knowledge of others, this is a project you might want to check out...

Follow the Discussion

  • DefearDefear

    When I'm trying to load project, it says "The project type is not supported by this installation." I have visual studio 2010. Do I need to install some additional extras to VS?

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    Sorry about that... Due to all my blogging and projects I look at I have just about everything installed.

    Yes, you'll need the Visual Studio 2010 SDK installed (And be using VS Pro or better)

    Background: Each project contains a number of "Project types" that it needs. When you get that error it means VS can't find one or more of these types.

    Here's the type's from this project (in the CSProg file)

        <ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

    And the first one is:

    {82b43b9b-a64c-4715-b499-d71e9ca2bd60}
    Extensibility Project

    So you'll need the Visual Studio 2010 SDK (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=2680) or Visual Studio 2010 SP1 SDK (http://www.microsoft.com/download/en/details.aspx?id=21835) and since that requires VS Professional...

    Hope this helps.

  • DefearDefear

    Thank you, it works now.
    I have VS2010 Professional, because I am student and we got it at school.
    But it didn't work with VS 2010 without SP1. Without SP1 all commands were loaded, but when I tried some shortcut nothing happen, just blank screen. With SP1 it works fine. So now can I study the code :) Thanks again for help.

  • SomeoneSomeone

    I always tell people that the mouse is the keyboard for morons.

  • WarrenWarren

    I want something that kind of does the opposite. When I do something that has a shortcut equivalent then show that. So that I can hopefully remember and use it the next time.

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.