0

I'm developing a Visual Studio Extension (Package), capable of interacting with Workflow Foundation 4 activities.

If the activity is opened in "code view", I'm able to access the xaml code and parse it's properties. But if the activity is opened in "design mode" i'm having trouble to access the activity elements or the xaml code.

var dte = (DTE2)serviceProvider.GetService(typeof(SDTE));
if (dte != null && dte.ActiveDocument != null)
{
   String xamlPath = dte.ActiveDocument.FullName;
   var document = (TextDocument)dte.ActiveDocument.Object("TextDocument");
   if (document != null)
   {
       //Code View
       var editPoint = document.CreateEditPoint(document.StartPoint);
       String xaml = editPoint.GetText(document.EndPoint);
   }else{
       //Designer ?????
       //(dte.ActiveDocument.ActiveWindow.Object.designerHostView).ContentText;
       //?????
       }

Can you guys give me an hint?

Tom
  • 302
  • 2
  • 5
  • 14

1 Answers1

0

Done this with reflection..

dte.ActiveDocument.ActiveWindow.Object it's a designerHostView found in \Common7\IDE\Microsoft.VisualStudio.Activities.dll

ContentText is a IDesignerViewToContractHostAdapter found in \Common7\IDE\HostSideAdapters\Microsoft.VisualStudio.Activities.HostAdapter.dll

Tom
  • 302
  • 2
  • 5
  • 14