locked
Designer rehosting questions - Please help RRS feed

  • Question

  • I am trying to rehost the wf designer inside a wpf window. I have build custom activities and activity designers.

    1) When a custom activity is dragged and dropped onto the workflow I want to launch a custom property editing window designed specially for this activity.
          i) what is the best way to achieve this?
          ii) when user selects the properties on the custom property window and closes, how to bind them to the custom activity

    2) When a custom activity is dragged and dropped onto the rehosted workflow designer how to automatically set the default value for an InArgument?

    3) I pass in some inputs to the workflow when it is executed by passing in the dictionary object to the WorkflowInstance class. These inputs should be available to all activities of the workflow. How to achieve this for the workflows created using the designer rehosted application?
    For example when creating workflow using Visual Studio I pass in the following dictionary object to the WorkflowInstance constructor when my workflow is executed

    var wfParams = new Dictionary<string, object>() { { "Equipment", "787"} };
    WorkflowInstance myInstance = new WorkflowInstance(new Sequence1(), wfparams);
    myInstance.Run();

    And in the Sequence activity I add an argument named 'Equipment' (direction=In, type=string) whose value will be set to '787' during runtime automatically.

    In the rehosted designer window I do not see a way to add Arguments. I can add only Variables.

    Any help will be really appreciated. Thanks in advance.


     





    Monday, October 19, 2009 10:11 PM

Answers

  • here we go:

    1) When a custom activity is dragged and dropped onto the workflow I want to launch a custom property editing window designed specially for this activity.
          i) what is the best way to achieve this?
          ii) when user selects the properties on the custom property window and closes, how to bind them to the custom activity

    You will need to have a custom activity designer that hooks on ModelItemChanged and if a value is not set, will pop a dialog.  A better way to do this would be to use DialogPropertyValueEditor so that folks can choose to get a popup from the property grid, or to have a button on the designer that lets someone opt into this.  In order to bind it, you would need to take the result of the dialog and apply that to the ModelItem that represents your activity (mi.Properties["Foo"].SetValue(output from Window) ).



    2) When a custom activity is dragged and dropped onto the rehosted workflow designer how to automatically set the default value for an InArgument?

    I think you can use System.ComponentModel.DefaultValue, you can set it in the constructor, or you can provide a default value for the argument if you are authoring your activity in xaml.


    3) I pass in some inputs to the workflow when it is executed by passing in the dictionary object to the WorkflowInstance class. These inputs should be available to all activities of the workflow. How to achieve this for the workflows created using the designer rehosted application?
    For example when creating workflow using Visual Studio I pass in the following dictionary object to the WorkflowInstance constructor when my workflow is executed

    var wfParams = new Dictionary<string, object>() { { "Equipment", "787"} };
    WorkflowInstance myInstance = new WorkflowInstance(new Sequence1(), wfparams);
    myInstance.Run();

    And in the Sequence activity I add an argument named 'Equipment' (direction=In, type=string) whose value will be set to '787' during runtime automatically.

    In the rehosted designer window I do not see a way to add Arguments. I can add only Variables.


    In order to add arguments you need to operate on an ActivityBuilder, not a Sequence (see my post here, and replace "ActivitySchemaType" with ActivityBuilder).


    hope this helps!

    matt

    Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle
    Tuesday, October 20, 2009 7:54 PM

All replies

  • Can someone from MSFT please help.

    Thanks.
    Tuesday, October 20, 2009 4:23 PM
  • here we go:

    1) When a custom activity is dragged and dropped onto the workflow I want to launch a custom property editing window designed specially for this activity.
          i) what is the best way to achieve this?
          ii) when user selects the properties on the custom property window and closes, how to bind them to the custom activity

    You will need to have a custom activity designer that hooks on ModelItemChanged and if a value is not set, will pop a dialog.  A better way to do this would be to use DialogPropertyValueEditor so that folks can choose to get a popup from the property grid, or to have a button on the designer that lets someone opt into this.  In order to bind it, you would need to take the result of the dialog and apply that to the ModelItem that represents your activity (mi.Properties["Foo"].SetValue(output from Window) ).



    2) When a custom activity is dragged and dropped onto the rehosted workflow designer how to automatically set the default value for an InArgument?

    I think you can use System.ComponentModel.DefaultValue, you can set it in the constructor, or you can provide a default value for the argument if you are authoring your activity in xaml.


    3) I pass in some inputs to the workflow when it is executed by passing in the dictionary object to the WorkflowInstance class. These inputs should be available to all activities of the workflow. How to achieve this for the workflows created using the designer rehosted application?
    For example when creating workflow using Visual Studio I pass in the following dictionary object to the WorkflowInstance constructor when my workflow is executed

    var wfParams = new Dictionary<string, object>() { { "Equipment", "787"} };
    WorkflowInstance myInstance = new WorkflowInstance(new Sequence1(), wfparams);
    myInstance.Run();

    And in the Sequence activity I add an argument named 'Equipment' (direction=In, type=string) whose value will be set to '787' during runtime automatically.

    In the rehosted designer window I do not see a way to add Arguments. I can add only Variables.


    In order to add arguments you need to operate on an ActivityBuilder, not a Sequence (see my post here, and replace "ActivitySchemaType" with ActivityBuilder).


    hope this helps!

    matt

    Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle
    Tuesday, October 20, 2009 7:54 PM