locked
Dynamically get the current instance of the workflow within a re-hosted WPF application RRS feed

  • Question

  • Hi,

    the scenario is: I create a re-hosted WPF application for the workflow designer, and within this designer I can edit the workflow(sequence, flowchart) with pre-defined and custom activities. The question is, how can I programmatically get an instance of the current workflow. Thereafter I can do some manipulations on this instance.

    Thx,

    Bob

    Wednesday, October 27, 2010 1:00 PM

Answers

  • hi Bob,

    you can use ModelService to get the root model item and then get the current activity. Then it depends on what's the root, if your rehost's root is ActivityBuilder, then you can use following to get:

    Designer.Context.Services.GetService<ModelService>().Root.Properties["Implementation"].ComputedValue;

    If the root is a normal activity, then you just get the root:

    Designer.Context.Services.GetService<ModelService>().Root.GetCurrentValue();

     

    thanks,

    Anders


    This posting is provided "AS IS" and confers no rights or warranties.
    • Proposed as answer by Andrew_Zhu Monday, November 1, 2010 9:12 AM
    • Marked as answer by Andrew_Zhu Tuesday, November 2, 2010 8:16 AM
    Wednesday, October 27, 2010 2:54 PM