locked
WF4 and UI Flow RRS feed

  • Question

  • Just wondering if there is any guidance out there about how to use WF4 (RC) to control UI flow.  I'm new to Workflow, and I am looking to see if I can have a presentation layer component start a workflow and interact with that workflow to determine screen flow.  I'm using WPF in the presentation layer if that helps at all.  I've been playing with WF for a bit now and keep running in circles trying to figure out the best way for the workflow to inform my presentation component of the current state of the workflow.  Basically, I can't figure out the best way to communicate to/from the presentation component to/from the workflow. 

    Any pointers would be greatly appreciated.

    Thanks,
    David
    Friday, March 5, 2010 1:39 PM

All replies

  • There is a sample in the .net 4 RC WCF-WF samples package (WF_WCF_Samples\WF\Scenario\WPFWFIntegration).

    I'm also working on the integration between wpf and wf since wf 3.0, but it was really painful.
    With WF 4.0, I reached great results.
    I saw two possible ways to achieve the goal: one consists of creating custom activities which perform operations over the UI. The second (my favourite) consists of working with the M-V-VM pattern; your workflow performs operation over the view models, and reflecting changes over the UI is left to the WPF system (through datatemplates, visual state etc.).

    Hope this helps,
    Francesco
    Friday, March 5, 2010 2:49 PM
  • That paricular sample you mention doesn't seem to help me in my particular situation.  I guess what I'm trying to do is implement a state machine such that external code can recognize that the workflow is in State A and therefore show Screen A and then respond back into the workflow with Data A. 

    Perhaps a more specific example:  This is a workflow that guides a user through a grocery store.  The user begins by submitting a list of items they would like to put in their cart.  The workflow then will then organize that list according to aisles (so that the user can go through the market in the proper order).  So the workflow needs to tell the UI "take the user to item A".  (I have this part I believe).  However, our workflow needs to be told how many of that item the user is putting in their cart.  So, before the workflow can "take the user to Item B" it needs to hear from the client code how much.

    This is as simple an example I can come up with a the moment without actually describing our product (which might get me in trouble).  The main problem is this communication between the workflow and external code (the invoker) and the fact that this communication takes place not just at the beginning and end but throughout the workflow.

    I don't want to pass in View Models because I'd like for the workflow to be UI technology agnostic as much as possible.  I'd simply like the workflow to say "I'm waiting for an X before I will continue".  Also, not sure if it changes things, but eventually we will have quite a few smaller workflows/activities that can be assembled into more complicated workflows (by developers not end users).
    Sunday, March 14, 2010 5:48 AM
  • I have implemented a WPF MVVM application with a main window containing a frame control that loads a series of pages into the frame based on a flowchart workflow. This allows the workflow to set the sequence of pages, and can navigate forward and back through controls on the main window. It uses a custom activity and a custom extension to provide the communication between the workflow and the host window's viewmodel. Works quite well. Since your main problem is in communicating between the workflow and external code, consider the use of a custom workflow extension as I did. Easy to implement.

    I too am working with code I cannot share, but am willing to provide general information if you have any questions.

    Monday, May 10, 2010 5:13 AM
  • Hi,

    Can any body guide on how WF 4 can be used to drive the flow of pages in UI.

    For Ex: If user is on Page A, then workflow state will determine that after Page A, user should be directed to which page. The workflow should be persistable.

    Does WF 4 supports this.

    I have not seen any such sample provided by Microsoft.

    Thanks

    Neha

    Friday, February 11, 2011 11:49 AM
  • Any pointers.

    Experts please reply.

    can WF 4 be used to drive UI page flow or not.

    Thanks

    Neha

    Thursday, February 24, 2011 11:51 AM
  • Something like this?

    http://aspnetpageflow4.codeplex.com/

    (Look for the source code)


    Pablo Rotondo http://www.datapayasadas.com.ar
    Thursday, February 24, 2011 7:06 PM