Search Wiki:

WF4 State Machine Driven WPF UI

Sample application that demonstrates a WPF UI driven by a WF4 State Machine using the Model-View-ViewModel (MVVM) Pattern

Download WF4 State Driven WPF UI v1.2
Watch endpoint.tv State Machine Driven WPF UI

There are two versions of this sample that are implemented with different strategies for detecting state changes.
  • Explicit Strategy - Uses activities to Enter/Exit states and enable commands
  • Tracking Strategy - Uses tracking data to detect state transitions and enabled commands

WPFStateDrivenUI.png

The tracking strategy is simple and requires no additional activities
  • Create two enums, one that describes states and another that describes transitions
  • The DisplayName property of your activities must match the name of the enum
  • Enter a state when an ActivityStateRecord matching the state enum is Executing
  • Enter a state when an ActivityStateRecord matching the state enum is Closed
  • Disable all commands when an ActivityStateRecord matching the transition enum is Closed
  • Enable a command when an ActivityScheduledRecord shows a child activity matching the transition enum is scheduled
TrackingStrategy.png

The explicit strategy requires you to use activities to notify of state transitions
ExplicitStrategy.png
Last edited Dec 31 2010 at 7:51 PM  by RonJacobs, version 11
Updating...
Page view tracker