locked
WorkflowInspectionServices and the workflow service(xamlx) RRS feed

Answers

  • You can load the xamlx file as a WorkflowService as

    WorkflowService service = XamlServices.Load(new FileStream(@"file path to your xamlx file here", FileMode.Open)) as WorkflowService;
    And WorkflowService.Body is the implementation of the service and also just a normal Activity, you can use WorkflowInspectionServices as whatever you want.
    • Proposed as answer by Tim Lovell-Smith Friday, December 18, 2009 12:25 AM
    • Marked as answer by binarycary Friday, December 18, 2009 2:13 AM
    Thursday, December 17, 2009 1:29 PM

All replies

  • You can load the xamlx file as a WorkflowService as

    WorkflowService service = XamlServices.Load(new FileStream(@"file path to your xamlx file here", FileMode.Open)) as WorkflowService;
    And WorkflowService.Body is the implementation of the service and also just a normal Activity, you can use WorkflowInspectionServices as whatever you want.
    • Proposed as answer by Tim Lovell-Smith Friday, December 18, 2009 12:25 AM
    • Marked as answer by binarycary Friday, December 18, 2009 2:13 AM
    Thursday, December 17, 2009 1:29 PM
  • thanks for your help.
    Friday, December 18, 2009 2:17 AM
  • Hi, 

    I did the same thing, try to get the activity of xaml file, but I received this error:

     

    "MissingMethodException: No default constructor found for type "System.Activities.Activity". You can use the argument of FactoryMethod directives to construct this type.

    at .....

     

    The snapshot of the error message can be found in: 

    http://picasaweb.google.com/lh/photo/BS1ccjLeX60z3VZd0hH-7WZz9_vC3cvFJMfDSE9qJj8?feat=directlink

     

    Code snippet:

     

    private WorkflowService _ws;
    
    _ws = XamlServices.Load(new FileStream(filename, FileMode.Open)) as WorkflowService;
    

     

    the value of filename : "C:\\Documents and Settings\\amurdopo\\Desktop\\Debug\\exampleFlowchartv2.xaml"

    Then the actual exampleFlowchartv2.xaml is shown below

    Insert Code Block
    Language:  
    	
    <Activity mc:Ignorable="sap" x:Class="Testplan" sap:VirtualizedContainerService.HintSize="654,676" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
     <Flowchart sap:VirtualizedContainerService.HintSize="614,636" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
      <sap:WorkflowViewStateService.ViewState>
       <scg:Dictionary x:TypeArguments="x:String, x:Object">
        <x:Boolean x:Key="IsExpanded">False</x:Boolean>
        <av:Point x:Key="ShapeLocation">270,2.5</av:Point>
        <av:Size x:Key="ShapeSize">60,75</av:Size>
        <av:PointCollection x:Key="ConnectorLocation">300,77.5 300,107.5 300,180.5</av:PointCollection>
       </scg:Dictionary>
      </sap:WorkflowViewStateService.ViewState>
      <Flowchart.StartNode>
       <x:Reference>__ReferenceID0</x:Reference>
      </Flowchart.StartNode>
      <FlowStep x:Name="__ReferenceID0">
       <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
         <av:Point x:Key="ShapeLocation">194.5,180.5</av:Point>
         <av:Size x:Key="ShapeSize">211,59</av:Size>
        </scg:Dictionary>
       </sap:WorkflowViewStateService.ViewState>
       <WriteLine sap:VirtualizedContainerService.HintSize="211,59" Text="asdf" />
      </FlowStep>
      <FlowStep>
       <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
         <av:Point x:Key="ShapeLocation">154.5,320.5</av:Point>
         <av:Size x:Key="ShapeSize">211,59</av:Size>
        </scg:Dictionary>
       </sap:WorkflowViewStateService.ViewState>
       <WriteLine sap:VirtualizedContainerService.HintSize="211,59" Text="asdf2" />
      </FlowStep>
     </Flowchart>
    </Activity>
      
    
    Is it because I have custom activity in my XAML file?
    Thursday, September 23, 2010 10:35 AM