Friday, October 23, 2009

A bit of creepiness for Halloween

I’ve got a new laptop with Windows 7.  Overall I’m pretty happy but it does seem to have some trouble staying connected to my home wireless network.  I went over to the Verizon website to see if there were any firmware upgrades for my modem/router and saw the following:


This is just creepy because it alternates between the above and this:


and then it blinks:



Thursday, June 25, 2009

Programmatically Changing Z-Order of DSL Shapes

If you want to programmatically change the Z-Order of a shape in a Visual Studio based DSL, don’t even bother trying to change the ZOrder property.  Rather, get the shape’s parent and change the order of the items in the NestedChildShapes collection.

This isn’t very well documented and a Google search using “zorder dsl change” doesn’t really pull up much useful information.  However (somewhat to my surprise) a Bing search using the same term turns up the answer as the first result.

Wednesday, June 10, 2009

How to Dynamically Customize the Property Window

The on-line help for the Microsoft Visual Studio Domain-Specific Language (DSL) tools explains how to prevent domain properties from appearing in the properties window:

You can prevent domain properties from appearing in the Properties window by setting the Is Browsable property to False. The Is Property Browsable property is available on domain roles.

However, this is a compile-time configuration.  This does not work if you need to optionally display a property based on some runtime state information.

Fortunately, a bit of digging with the most excellent Reflector tool shows that the Microsoft.VisualStudio.Modeling.Design.ElementTypeDescriptor has a virtual method, ShouldCreatePropertyDescriptor, that can be overridden.

Suppose you have a domain class Person with the properties IsMarried and WeddingDate.  You want the WeddingDate property to show in the property window only if the IsMarried property is true.

First, create a ElementTypeDescriptionProvider for the Person domain class:

class PersonTypeDescriptorProviderElementTypeDescriptorProvider    { }

Now, override the CreateTypeDescriptor() method to create a custom type descriptor named PersonTypeDescriptor:

class PersonTypeDescriptorProvider : ElementTypeDescriptionProvider


   protected override ElementTypeDescriptor

        CreateTypeDescriptor(ICustomTypeDescriptor parent, ModelElement element)

     {return new PersonTypeDescriptor(parent, element);}



Using the designer, select the Person domain class and a custom attribute of the type TypeDescriptionProvider passing the PersonTypeDescriptorProvider type to its constructor.

Now create the PersonTypeDescriptor class:

class PersonTypeDescriptor : ElementTypeDescriptor


    public PersonTypeDescriptor(

        ICustomTypeDescriptor parent,

        ModelElement element) :base(parent, element)





Finally, override ShouldCreatePropertyDescriptor method:

protected override bool ShouldCreatePropertyDescriptor(ModelElement requestor, DomainPropertyInfo domainProperty)


    if (domainProperty.Name == "WeddingDate")

        return ((Person)requestor).IsMarried;

    return base.ShouldCreatePropertyDescriptor(requestor, domainProperty);



It’s as simple as that.

Wednesday, May 6, 2009

A Remote Desktop Feature Request

Typically, I have several remote desktop sessions going at the same time on my desktop.  Within these remote sessions I might be running different applications or monitoring something.  I’d really like it if Remote Desktop supported a feature similar to VMWare’s Unity mode.   It would be really cool if I could point to an application window on a remote desktop and “unify” it with my main desktop.

Does anyone know of a 3rd party utility that makes this possible?  If so, answer here.