Extensions Made Easy: UseSmallImage and custom ordering.

Hey guys,

I’m terribly tired, but before hitting my bed I wanted to let you know that EME 1.11.3 is ready, tested, checked in, tested again and published.

The most notable change is that I refactored the EasyCommandExporter a wee bit.  It only contains one constructor from now on (I introduced a second a while ago for some Dispatcher finetuning), which contains some  mandatory and some optional parameters:

public EasyCommandExporter(
  string displayName,
  string description,
  string groupName,
  Uri imageUri,
  Dispatcher dispatcher = Dispatcher.PreferCurrentActiveScreen, //Refactored: overloaded ctor -> optional parameter
  bool useSmallImage = false, //New optional parameter
  string prefixUsedForSortingWithinGroup = "" //New optional parameter
)

UseSmallImage

Set it to true to use a “small” image for your command.  Thanks, Kivito, for teaching me about this (I completely missed it).  You can vertically stack 3 “small” commands in your ribbon for each “normal” command.

PrefixUsedForSortingWithinGroup

By default, the EME framework sorted your EasyCommands by DisplayName to accomplish consistent ordering.

As falkao indicated, a developer might want to take control of the order in which the commands should be shown.  I played around with it a bit and found that:

  • ordering the commands yourself is especially useful when mixing “small” and “normal” commands, so you can choose the “small” commands to stack…
  • a “prefix” string is easier to maintain than a “priority” integer, especially when adding new commands to the middle of your group…

Ergo, vis-a-vis, the EME framework now sorts your EasyCommands by “{PrefixUsedForSortingWithinGroup} – {DisplayName}”.

 

Time to turn my LightSwitch out for tonight. :-)

About these ads

8 thoughts on “Extensions Made Easy: UseSmallImage and custom ordering.

  1. Pingback: Windows Azure and Cloud Computing Posts for 1/18/2012+ - Windows Azure Blog

  2. Great – thanks for this!

    Also, would you mind changing the visibility of the innerCommand property of the EasyCommand wrapper class from private to public so we can get access to our custom EasyCommandExporter descendants directly? I’d like to add metadata to custom commands that can be accessed from within xaml without altering your source code.

    Regards,
    Robert

    • Hey Robert,
      checked in a version yesterday where I exposed the InnerCommand property. You’ll need to cast it to your own type, ofcourse.
      Let me know if it works and helps for your shell extension? :-)

      • Thanks, that sounds perfect!

        However, I don’t see it yet in EasyCommand.cs (the last check-in seems to be from January 17). Are the most current files in the CodePlex SVN repository, or is there a delay between the extension gallery and the public source code?

        Thanks again,
        Robert

      • Delay, caused by my personal laziness :(
        Well not laziness, working hard on a brand new public extension… :-)
        Let me know if the current sources work for you!
        Kind regards

        Jan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s