none
Add work item reference to UML Subsystem element RRS feed

  • Question

  • Hello,

    What I want to achieve is to make an UML Use Case extension for Visual Studio Ultimate that will automatically bind a Subsystem element to a Work Item from TFS when it is drag and dropped on the diagram.

    I implemented IGestureExtension interface and added behavior for: 

    public void OnDragDrop(ShapeElement targetDropElement, DiagramDragEventArgs diagramDragEventArgs) method.

    Also imported IDiagramContext:

    [Import]

    IDiagramContext _context { get; set; }

    So, now I am able to access the model element behind the dropped shape. Below is the piece of code for that:

    var childShapes = _context.CurrentDiagram.ChildShapes;

              var lastShape = _context.CurrentDiagram.ChildShapes.Last();

              var subsystem = lastShape.GetElement() is ISubsystem;

              if (subsystem)

              {

                  var lastShapeElement = lastShape.GetElement() as ISubsystem;

                  var referenceHandle = string.Empty;

                  lastShapeElement.AddWorkItemReference(referenceHandle);

              }

    So far so good, but

    AddWorkItemReference(string referenceHandle) is an extension method with no documentation on MSDN.

    Does anyone know how can build that referenceHandle string ?

    Friday, November 25, 2011 11:55 AM

Answers