none
FreeformActivityDesigner in WF 4?

    General discussion

  • Today I had a first quick look at the WF4 Designer with Visual Studio 2010 Beta 1 and some of the classes below.

    I was quite surprised that there is no substitute for the StateMachineWorkflowActivity in the new namespace System.Activities.

    What concernes me really is the lack of the FreeformActivityDesigner that was a base class of the StateMachineWorkflowDesigner. We rely on this designer heavily in our product and there seems to be no substitute for it in WF4. Okay, there is the FlowchartDesigner which is internal and too tightly bound to the Flowchart activity anyway. And there is the FreeFormPanel class which is also internal and not sufficient for our needs.

    I see a strong need for a public class that would be a base for the FlowchartDesigner and would be a WF4 equivalent of the FreeformActivityDesigner. Please consider putting it back to action.

    Thanks,
    Bogdan

    Friday, May 22, 2009 12:43 PM

All replies

  • Bogdan, thanks for checking out the bits.  I'd like to hear more about the workflow type you are modeling with the FreeformActivityDesigner.


    Our goal was to have a robust, extensible freeform base that could be used to construct a number of different graph oriented workflow designers.  Unfortunately, we will not have time to complete that for vs2010.  That said, we've made a number of improvements in the designer programming model that will make the scenario of building a custom composite activity designer for something like a state machine or petri net a lot easier.  I'd encourage you to look into the ItemsPanelTemplate of the WorkflowItemsPresenter which might help you out, or you could also start with an existing graph layout toolkit and use the WorkflowItemPresenter to help out with your nodes.  If you were to place that in an activity designer, you will get all of the editor functionality like selection, copy paste, undo redo, etc.

    Thanks,

    matt
    Program Manager -- Modeling Platform and Tools http://blogs.msdn.com/mwinkle
    Friday, May 22, 2009 4:50 PM
  • ItemsPanelTemplate of the WorkflowItemsPresenter
    Matt W, is there any explanation of how these different pieces are involved in layout by WorkflowDesigner?

    I find myself wanting to make a custom state machine diagram, and will likely end up doing just what you suggest (start with some graph layout toolkit), but I am having difficulty building a mental model of how layout currently happens.

    Some specific questions:

    1. What determines the minimum width (200 pixels) of most activities?

    2. How does WorkflowDesigner invoke the Designer associated with the standard activities?  I found a DesignerAttribute using TypeDescriptor.GetAttributes() on a Flowchart, and I see that the type is a hidden class Activities.Core.Presentation.FlowchartDesigner, how would a custom W.D. call that?

    3. If want to completely take over the view (e.g. starting with some other graph layout mechanism than the standard WF4 one), would one subclass WorkflowDesigner?  Whether yes or no, what would a custom Workflow Designer involve?  Can I talk you into hacking out some trivial example using a WPF Canvas, which I could then massage into what I need?

    The kind of diagram I intend to end up with (eventually) would be vaguely like Verilog (IC design), LabView (dataflow), or R.O.O.M. (real-time parallel communicating actors w state machines)  - a more sophisticated diagram with labeled in/out nodes and labeled links, including the ability to propagate nodes from a sub-diagram to an outer diagram. For example, dataflow inputs A and B reach a composite activity, which when expanded, shows those lines connecting to specific activities inside that little machine. Or another example, if I were modeling a state in the current FlowGraph, the INSIDE of a state (composite activity) would have a FlowSwitch on the current event (received via a message inside the state) - those event cases need to escape the state, so that in the outer-level diagram they can be drawn to connect to other states.
    • Edited by ToolmakerSteve Thursday, November 19, 2009 6:59 PM explanation of R.O.O.M.
    Thursday, November 19, 2009 6:29 AM
  • Hi Matt's on vacation, but I can take a stab at this:
    1. We have a default template for collapsed activities that sets the minimum activity width. If you want a different default width, you can write your own template to use in its place for your custom activities. Min width of expanded flowchart is hardcoded separately I think in the designer itself.
    2. The SDK samples for WorkflowItemsPresenter and ExpressionTextBox show two different methods of binding designers to activities, see http://msdn.microsoft.com/en-us/library/dd744850(VS.100).aspx and http://msdn.microsoft.com/en-us/library/ee663224(VS.100).aspx. You can also bind designers to activities in the RegisterMetadata call in FooDesigner.xaml.cs, which would call AddCustomAttribute for the binding to the activity type. As you noticed our activity designers are internal so that definitely limits their utility in your activities.
    3. Only our activities using the free form layout have any graph logic. If you write your own custom activity designer, you can write your own routing logic and you won't pick up ours. The WorkflowItemsPresenter SDK sample is a toy scenario that can get you started, it demonstrates the use of the ItemsPanelTemplate.

    Thanks
    Cathy
    Monday, November 23, 2009 8:12 PM
  • Hi Cathy - thanks for the suggestions.

    I've got it working well enough inside FlowChart for the time being, so I'll build on that.  But I am glad to have some sense of what would be involved if I wished to move beyond that in the future.

    Steve
    Tuesday, November 24, 2009 12:17 AM
  • Hi Matt's on vacation, but I can take a stab at this:
    1. We have a default template for collapsed activities that sets the minimum activity width. If you want a different default width, you can write your own template to use in its place for your custom activities. Min width of expanded flowchart is hardcoded separately I think in the designer itself.
    2. The SDK samples for WorkflowItemsPresenter and ExpressionTextBox show two different methods of binding designers to activities, see http://msdn.microsoft.com/en-us/library/dd744850(VS.100).aspx and http://msdn.microsoft.com/en-us/library/ee663224(VS.100).aspx. You can also bind designers to activities in the RegisterMetadata call in FooDesigner.xaml.cs, which would call AddCustomAttribute for the binding to the activity type. As you noticed our activity designers are internal so that definitely limits their utility in your activities.
    3. Only our activities using the free form layout have any graph logic. If you write your own custom activity designer, you can write your own routing logic and you won't pick up ours. The WorkflowItemsPresenter SDK sample is a toy scenario that can get you started, it demonstrates the use of the ItemsPanelTemplate.

    Thanks
    Cathy

    It's comprehensive, Thanks for your analysis!
    Monday, February 21, 2011 11:15 PM