0

I'm trying to create a Visual Studio extension that works alongside the Sequence Diagram Designer, and I'd like to be able to register for an event that will notify me whenever the selection changes on the diagram. The IMonitorSelectionService interface appears to offer such an event, but I don't know how to get an instance of this service from a VSPackage.

What do I need to do in order to get an instance of this service, or is there some other more easily accessible event that I could use instead?

shader
  • 801
  • 1
  • 7
  • 25

1 Answers1

1

You should be able to do the following:

IMonitorSelectionService monitorSelectionService = ((IServiceProvider)store).GetService(typeof(IMonitorSelectionService)) as IMonitorSelectionService;

Where store is the Store of the diagram you're interested in.

Aaron Marten
  • 6,548
  • 1
  • 32
  • 41
  • Is there any particular context that I need in order get the service? Currently, I'm getting null when I try to retrieve it using Package.GetGlobalService – shader Jul 13 '11 at 18:30
  • I updated the answer. You may also want to take a look at this document to see if a UML extension would suit your needs. http://msdn.microsoft.com/en-us/library/gg616043.aspx – Aaron Marten Jul 14 '11 at 15:43