Welcome to MSDN Blogs Sign in | Join | Help

Introducing the Pageflow Sample

    Most people think of workflows as a tool to represent and automate back-end business processes. Back-end business processes normally require some user interaction but their main purpose is not to drive the user experience or manage the UI. However, there is a growing type of application that leverages workflow as a tool to drive the user interaction and drive the user experience of an interactive process. This type of technology is called page flow.

    Last year at TechEd, we showed off some bits we had been working on internally that were designed to make that possible, the ability to model the user interaction of an application using workflow. This approach provides developers the ability to continue managing the complexity of their application in a structure and scalable manner. It turned out that the code we showed at TechEd wasn't going to end up in any of the product releases, so the dev team requested permission to release that code as a sample of how one can implement a generic navigation framework using WF that can support multiple UI technologies (i.e. ASP.NET and WPF).  This year, I just finished giving a talk showing this off and talking about how it will be available today!

    Thanks go to Shelly Guo, the developer and Israel Hilerio, the PM who had worked on this feature, and to Jon Flanders for providing packaging and quality control

    Now for the good stuff, download the bits from here!

    Navigate to setup.exe and run the setup, this will copy the sample projects and the source code for the sample, as well as some new visual studio project templates.

    Now, let's open up a sample project, so navigate to the samples directory and open the ASPWorkflow sample, this will show off both an ASP.NET Front end as well as a WPF Controller (you can actually use the two together). Let's get to the good stuff right away, and open up the workflow file.

    Wow… what's going on here? It kind of looks like a state machine, but not really. What has been done here is to create a new base workflow type. Things like SequentialWorkflow and StateMachineWorkflow aren't the only ways to write workflows, they are just two common patterns of execution. A NavigatorWorkflow type has been created (and you can inspect the source and the architecture document to see what this does) and a WorkflowDesigner has been created for it as well (again, this source is available as a guide for those of you who are creating your own workflow types).

    Each of the activities you see on the diagram above is an InteractionActivity, representing the interaction between the user (via the UI technology of their choosing) and the process. A nice model is to think of the InteractionActivity as mapping to a page within a UI. The output property is the information that is sent to that page (a list of orders or addresses to display) and the input is the information that is received from the page when the user clicks "submit". The InteractionActivity is a composite activity, allowing one to place other activities within the activity to be executed when input is received. The interesting property of the InteractionActivity is the Transitions collection. By selecting this and opening its designer, we are presented with the following dialog:

    This allows us to specify n-transitions from this InteractionActivity or "page" to other InteractionActivities. And we can specify this via a WF activity condition. This way, we could forward orders greater than $1000 to a credit verification process, or orders containing fragile goods through a process to obtain insurance from a shipper. What's cool about this, my page does not know about that process, it just says "GoForward" and my process defines what comes next. This de-couples the pages from the logic of your process.

    We then need to wire things up in config:

    <configSections>
    <section name="NavigationManagerSettings" 
    type="Microsoft.Samples.Workflow.UI.NavigationManagerConfigSection, Microsoft.Samples.Workflow.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=40B940EB90393A19"/>
    <section name="AspNavigationSettings" 
    type="Microsoft.Samples.Workflow.UI.Asp.AspNavigationConfigSection, Microsoft.Samples.Workflow.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=40B940EB90393A19"/>
    </configSections>
    
    

    <NavigationManagerSettings StartOnDemand="false">
      <Workflow mode="Compiled" value="ASPUIWorkflow.Workflow1, ASPUIWorkflow"/>
      <!--<Workflow mode="XOML" value="WebSite/XAMLWorkflow.xoml" rulesFile="WebSite/XAMLWorkflow.rules" />-->
      <Services>
        <add type="System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add type="System.Workflow.Runtime.Hosting.SqlWorkflowPersistenceService, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" ConnectionString="Initial Catalog=WorkflowStore;Data Source=localhost;Integrated Security=SSPI;" UnloadOnIdle="true"/>
      </Services>
    </NavigationManagerSettings>
    <AspNavigationSettings>
      <PageMappings>
        <add bookmark="Page1" location="/WebSite/Default.aspx"/>
        <add bookmark="Page2" location="/WebSite/Page2.aspx"/>
        <add bookmark="Page3" location="/WebSite/Page3.aspx"/>
        <add bookmark="Page4" location="/WebSite/Page4.aspx"/>
        <add bookmark="Page5" location="/WebSite/Page5.aspx"/>
        <add bookmark="LastPage" location="/WebSite/LastPage.aspx"/>
      </PageMappings>
      <ExceptionMappings>
        <add type="Microsoft.Samples.Workflow.UI.WorkflowNotFoundException" location="/WebSite/ErrorPage.aspx"/>
        <add type="Microsoft.Samples.Workflow.UI.WorkflowCanceledException" location="/WebSite/ErrorPage.aspx"/>
        <add type="System.ArgumentException" location="/WebSite/ErrorPage.aspx"/>
        <add type="System.Security.SecurityException" location="/WebSite/ErrorPage.aspx"/>
      </ExceptionMappings>
    </AspNavigationSettings>
    
    

     

    Finally, let's look inside an ASP.NET page and see what we need to do to interact with the process:

    AspNetUserInput.GoForward("Submit", userInfo, this.User);

    This code is specifying the action and is submitting a userInfo object (containing various information gathered from the page) to the InteractionActivity (in this case, it submits to the Page2 InteractionActivity). If we look at what we've configured as the Input for this InteractionActivity, we see the following, which we can then refer to in the transition rules in order to make decisions about where to go next:

    Plenty of other stuff we could talk about here, support for back button, persistence, etc and I could continue to ramble on about this in another record-length blog post, but I will stop here for now. I will continue to blog about this, look forward to hearing any and all types of feedback, and what you'd be interested in seeing in this. Moving forward, there aren't any formal plans around this, but if there is enough interest in the community, we could get it created as a project on codeplex. If that sounds intriguing either contact me through this blog, leave a comment so that I can gauge the interest in such a scenario.

    Go, grab the bits!  And, if you have feedback, please contact me.

Published Thursday, June 07, 2007 7:33 PM by mwinkle

Comments

# Page Flow Designer for ASP.NET

For designing and controlling the page flow through an application, Java-based platforms can take advantage

Thursday, June 07, 2007 5:39 PM by All About Interop

# Acropolis, CAB + WPF, PageFlow. What should I suggest to use?

I'm going to be confused. During the last three days we've seen: Acropolis : a set of tools to make it

Thursday, June 07, 2007 8:07 PM by Paolo Pialorsi - Bridge The Gap!

# Workflow Foundation 與 ASP.NET Pageflow 結合

微軟負責 Workflow Foundation 技術推廣的專家 Matt Winkler,日前在 Matt Winkler's blog 提供了一套整合 Workflow Foundation 與 ASP.NET

Thursday, June 07, 2007 10:57 PM by Tom Lee's blog

# Daniel Karlsson

Finally access to the stuff =)

Friday, June 08, 2007 1:59 AM by Daniel_Karlsson

# Acropolis si viitorul aplicatiilor client pe Windows

S-au intamplat destul de multe in ultima vreme in ceea ce priveste "clientii" Windows: Avem o noua versiune

Friday, June 08, 2007 8:31 AM by Weblogul lui Zoli

# AWESOME!

Awesome presentation yesterday.  Glad you got the bits posted. Look forward to leveraging your teams great work.

Friday, June 08, 2007 11:48 AM by ericmiles

# Introducing the Pageflow Sample

Introducing the Pageflow Sample

Friday, June 08, 2007 2:19 PM by Develop Better

# I Love the Smell of Irony in the Afternoon...

I couldn't help but chuckle at the installer for the WF-based ASP.NET Pageflow sample. It first asked

Friday, June 08, 2007 2:42 PM by There Must Be Some Mistake

# Using WF To Drive ASP.NET Page Flow

I came across this cool example of using WF to drive ASP.NET page flow. http://blogs.msdn.com/mwinkle/archive/2007/06/07/introducing-the-pageflow-sample.aspx

Friday, June 08, 2007 5:25 PM by Chris Koenig

# PageFlow WF Samples , Acropolis CTP

Page Flow WF sample Jon Flandr's-WCF and WF session at TechEd The Moth--.NET Framework 3.5 Glenn Block

Saturday, June 09, 2007 1:53 AM by ccBoy's WebLog

# PageFlow on Windows Workflow Foundation

The idea of using Windows Workflow foundation for driving the UI behavior of an application is a very

Saturday, June 09, 2007 2:14 AM by Vibro.NET

# Controlling Page Flow with Workflow Foundation - Sample Available

Matt Winkler gave a session this week at TechEd where he described how to use Windows Workflow Foundation

Saturday, June 09, 2007 6:57 PM by Chris Bowen's Blog

# Windows Workflow Page Flow Sample

I've had a couple of ISVs ask me about a Windows Workflow Foundation page flow session that was delivered

Monday, June 11, 2007 7:22 AM by David Gristwood's Blog

# ASP.NET Page Flow Using Windows Workflow - Why All The Recent Chatter?

Have you seen all the recent chatter on the MSDN Blogs about ASP.NET Page Flow this past week? The Web Client Software Factory has a Page Flow Application Block that does the same thing and is very, very slick. Read more...

# re: Introducing the Pageflow Sample

NavigatorWorkflow looks like a state machine to me.  Why create a new workflow type?

Tuesday, June 12, 2007 3:44 AM by wleong

# WF Pageflow sample

Most people think of workflows as a tool to represent and automate back-end business processes. Back-end

Tuesday, June 12, 2007 12:20 PM by Workflow Samples

# ASP.NET Workflow

Matt Winkler posted some very cool stuff regarding using Windows Workflow and ASP.NET on his blog a few

Tuesday, June 12, 2007 4:46 PM by Steven Smith

# Introduction to the Windows Workflow Foundation Pageflow sample

Most people think of workflows as a tool to represent and automate back-end business processes. Back

Tuesday, June 12, 2007 4:47 PM by ASP.NET on Channel9

# re: Introducing the Pageflow Sample

It's very good idea to do such work! but, how do you block your page flow. i mean, when u finish one step, u mustn't step down to another, u must "unload" the workflow instance. and then another guy logined to finish next step, how can i carry out this, pls?

Wednesday, June 13, 2007 2:37 AM by kexbar

# Pageflow questions: "What about WCSF / Acropolis / Codename 'foo'"?

So, I got a little bit of feedback from my initial post . First, thanks, it's great to see all of the

Thursday, June 14, 2007 4:34 PM by Matt W's Windows Workflow Place

# Pageflow Questions: Why not a state machine?

Here's a comment from my initial post introducing the pageflow sample from wleong: NavigatorWorkflow

Thursday, June 14, 2007 5:04 PM by Matt W's Windows Workflow Place

# Guy, go on your illustration about Page Flow

Eagerly, we hope to c your following wonderful illustrations about your PageFlow invention. OK?

Friday, June 15, 2007 3:41 AM by kexbar

# Using Windows Workflow Foundation for UI flow.

Matt Winkle introduced a sample solution called PageFlow which shows how to implement UI flow using the

Friday, June 15, 2007 4:50 PM by Public Sector Developer Weblog

# re: Introducing the Pageflow Sample

Is there a way to continue a PageFlow across Sessions?

Monday, June 18, 2007 9:34 AM by sprovencher

# Will the real PageFlow please stand up?

Several weeks ago, Matthew Winkler posted about a new sample of how to implement Page Navigation using

Tuesday, June 19, 2007 1:30 AM by My Technobabble

# Link dump: User Experience, Web Platform, Office System and more

Here are some interesting links that I found while catching up on blogs: User Experience: Your Britain

Friday, June 29, 2007 10:48 AM by David Boschmans Weblog

# Introducing the Pageflow Sample

Introducing the Pageflow Sample

Wednesday, July 18, 2007 12:43 PM by My blog

# Workflow Foundation 與 ASP.NET Pageflow 結合

微軟負責 Workflow Foundation 技術推廣的專家 Matt Winkler,日前在 Matt Winkler&#39;s blog 提供了一套整合 Workflow Foundation

Thursday, July 19, 2007 10:32 PM by 外部部落格

# Pumping with Windows Workflow Foundation

Weird title, I know. It will make sense soon... The last week I had a relative simple project that I

Thursday, September 06, 2007 4:15 AM by Rudi Grobler

# Recent WF Content Summary

I've been having some fun playing around with Visual Studio 2008 and the .NET Framework 3.5, and wanted

Monday, September 10, 2007 8:11 PM by Matt W's Windows Workflow Place

# re: Introducing the Pageflow Sample

He Matt,

Pageflow is a cool thing to work with.

Is there any sight of getting it on Codeplex?

BTW I made some changes to the framework which might be useable for other:

http://conducido.nl/blog/2007/11/29/directly-access-a-webpage-which-is-part-of-the-pageflow-workflow/

Some other questions are there coming more updates? Further documentation etc etc? Let me know what your plans are with pageflow.

Kinds Regards Wouter Crooy

Tuesday, December 04, 2007 1:01 PM by wouterc

# re: Introducing the Pageflow Sample

Does anyone know where can I find the sample code?  I just installed the PageFlowSetup.exe ver 1.1.  I can see the new templates fine.

Thanks,

Saturday, January 05, 2008 3:20 PM by tranfamily35

# re: Introducing the Pageflow Sample

Try :

[Drive:]\Program Files\Windows Workflow Foundation Samples\PageFlowSample

Other question, the sample was installed and compiled, but when I'm trying to run, it is giving an error when connecting to the DB.

Is any way to disable the connection to the DB?

Wednesday, January 30, 2008 8:04 PM by saavedrah

# Workflow Foundation 與 ASP.NET Pageflow 結合

微軟負責 Workflow Foundation 技術推廣的專家 Matt Winkler,日前在 Matt Winkler's blog 提供了一套整合 Workflow Foundation 與&#160;

Sunday, February 03, 2008 7:26 AM by Tom Lee's blog

# Workflow Foundation 與 ASP.NET Pageflow 結合

微軟負責 Workflow Foundation 技術推廣的專家 Matt Winkler,日前在 Matt Winkler&#39;s blog 提供了一套整合 Workflow Foundation

Sunday, February 03, 2008 8:02 AM by Noticias externas

# re: Introducing the Pageflow Sample

This sounds like a really cool idea.  

It would also be cool if validation rules could be specified for input fields.

I am super-excited about this idea, it has great potential.  I say "Go for it!".  Put it on Codeplex!

Wednesday, March 05, 2008 3:29 AM by BenL

# Workflow Foundation 與 ASP.NET Pageflow 結合

微軟負責 Workflow Foundation 技術推廣的專家 Matt Winkler,日前在 Matt Winkler&#39;s blog 提供了一套整合 Workflow Foundation

Thursday, July 24, 2008 3:47 AM by ASP.NET

# re: Introducing the Pageflow Sample

Is there any documentation for the NestedNavigator sample?  I can't get it to run and I'm not sure what it is supposed to do.

Wednesday, December 10, 2008 3:44 PM by alo

# re: Introducing the Pageflow Sample

Hello,

I am getting some error to compile NavigatorWork through .net WorkFlowComplier.

One is Error CS1061: 'Sample.NV234v0_2' does not contain a definition for 'InteractionActivity' and no extension method 'InteractionActivity' accepting a first argument of type 'Sample.NV234v0_2' could be found (are you missing a using directive or an assembly reference?) When i used transition between two or more InteractionActivity and with out transition its compiled properly.

Other is error 348: Compilation failed.

Type 'System.Workflow.Activities.SequenceActivity' in Assembly 'System.Workflow.Activities,

Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

is not marked as serializable when i used transition between any .Net Base Activities.

Please help me if any one know this issue.

Thanks in Advance.

Friday, February 06, 2009 1:33 AM by aftabhafeez

# Pageflow

Design and Implementation Notes The Seam project describes page flow as "complex user interactions." Microsoft's Matt Winkler describes pageflow

Friday, February 20, 2009 2:32 PM by Confluence: CollectionSpace
New Comments to this post are disabled
 
Page view tracker