http://blogs.clariusconsulting.net/vga

Victor García Aprea

Go Back to
vga′s Latest post

Adding Commands to a DSL from a 10,000ft view

The DSL Tools are a huge improvement towards getting a VS designer up and running in no time.

They make a good job of keeping you abstracted at a 10,000ft view from the inner workings of a Visual Studio designer.  You drag and drop shapes all around, defining your domain model and its graphical representation. You set properties here and there. And… you’re ready to go!

You now have thousands and thousands of automatically generated code implementing a VS designer which would have took you weeks to write if you went from scratch. That’s nice.

Now, let’s say you’re the kind of developer that likes to push the envelope and you come with the very wild idea of adding a menu command to the designer surface or a given shape of your DSL. Oh, yes, you’re wild.

At this point if you were an airplane you would have crashed. The nice 10,000ft altitude and the “I don’t have to worry about the dirty details” that you were used to while designing your domain model have changed for the feeling of hitting hard the ground.

You need to follow several steps procedure which includes things as dealing with a C++ preprocessor and knowing in lots of detail one of the most arcane format that Microsoft may have invented, the obscure world of Command Table definitions.

So, you’re already thinking of hiring a skilled senior C++ developer so you can add your menu command? Well, that’s not required if you’re willing to put the time to learn lots of non-interesting stuff about how to define a command, but if you have the time, you will eventually make it work (and that’s because you’re a wild developer, remember that).

With SFT we try to keep you at the 10,000ft for adding commands too. And in our latest public drop we’ve included an enhanced DSL Recipe Binder Wizard that will do the magic for you.

It allows you to choose between binding a command to a built-in shape (the designer surface, a link, etc) or one of your custom shapes (your foo shape), and specifying on which kind of selection you want your command to appear: single, multiple or any? Moreover, you want your command to appear only for those Foo shapes whose Bar whose property start with a ‘C’? Easy enough, click a checkbox specifying you want to customize the selection logic and you will get a partial class with an override method taking a Foo shape where you can write the single line of code required to check the Bar property.

This is how it looks like:

DslRecipeBinderWizard.png

Trust me, this is as easy as it gets.

Comments

10 Comments

  1. Что же значит быть полноценной женщиной? Каким образом достичь успеха в сегодняшнем мире? Ответы на эти и многие другие проблемы читайте в нашем онлайн-журнале.

    Вопросы семьи и карьеры, советы по стилю, имиджу, модные тенденции и самые горячие звездные новости. Мы заботимся о наших читательницах, подбирая для них интересную и правдивую информацию.

    Читать дальше – женский онлайн-журнал

  2. Thanks a lot for providing individuals with such a brilliant possiblity to discover important secrets from this website. It can be very sweet plus jam-packed with fun for me personally and my office colleagues to visit your site really 3 times every week to find out the newest guides you will have. And indeed, I’m just actually contented with the wonderful suggestions you give. Certain 2 facts in this post are clearly the most impressive we have had.

  3. Very well written post. It will be valuable to anyone who employess it, as well as myself. Keep doing what you are doing – looking forward to more posts.

  4. Qué tal amigos, buena redacción, buen contenido Saludos

  5. I believe what you said made a bunch of sense. But, think on this, what if you were to write a awesome post title? I ain’t saying your information isn’t solid., but suppose you added something that grabbed folk’s attention? I mean %BLOG_TITLE% is kinda plain. You should peek at Yahoo’s front page and note how they create post titles to grab people to open the links. You might try adding a video or a pic or two to grab readers excited about what you’ve got to say. In my opinion, it would bring your website a little bit more interesting.|

  6. I am continuously browsing online for articles that can help me. Thanks!

  7. You actually make it appear so easy with your presentation but I to find this topic to be really something that I feel I would never understand. It kind of feels too complex and very huge for me. I’m having a look ahead for your subsequent put up, I will try to get the dangle of it!

  8. Riaz (apply) is the most important component of playing tabla or any musical artwork. Be on guard towards reflected mild that bounces off drinking water and other shiny surfaces on the brightest times, too.

  9. I am often to blogging and i actually appreciate your content. The article has actually peaks my interest. I’m going to bookmark your website and keep checking for new information.