Workflow and RSS Demos

I was also asked for my RSS & Windows Workflow Foundation demos from launch so here goes with these. There areĀ 5 folders in the zip file:

  • ConsoleApplication1
  • DVD_Player_State_Machine
  • RSSActivityLibrary
  • SubscribeToRssFeeds
  • TrackingServiceDemo

Download the demos here

Let's take them one at a time.

 class MyActivity : Activity
  private string textToDisplay;

  public string TextToDisplay
    get { return textToDisplay; }
    set { textToDisplay = value; }

  protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
    return ActivityExecutionStatus.Closed;
  • ConsoleApplication1 (Needs .Net Fx 3.0)

    • The idea of this demo was just to build up a trivial workflow application from code. I create a console application then create a workflow activity (derived from System.Workflow.ComponentModel.Activity, see below). I then create a workflow class (deriving from System.Workflow.Activities.SequentialWorkflowActivity) and add one of my shiny new activities to it's activities collection. So my one activity will be executed in sequence. I then create a workflow runtime in my host (console application) and create a workflow instance. I can either create the workflow from code (using the workflow class I created as a blueprint) or from markup.
  • SubscribeToRssFeeds (Needs Vista or XP / WS with IE 7 installed)

    • This is a simple console app that demonstrates the use of the feeds platform in Vista (or XP / WS with IE7) to subscribe to some RSS feeds and get notified when a sync completes on each feed. You need to folder called \Test in your feedstore and the app will delete any feeds in that folder before subscribing to 4 new feeds and starting a sync.

  • RSSActivityLibrary (Needs .Net Fx 3.0 + Vista or XP / WS with IE 7 installed)

    • Building on SubscribeToRssFeeds, this workflow solution contains some simple RSS workflow activities (such as RemoveFeedsInFolder and AddFeed) and a test harness workflow that pulls some of these together to achieve a similar effect to the previous console application (but without notifications). There's nothing clever in here. The activities are not designed to be long-running (ie they are all synchronous). I leave it as an exercise for the reader to do this. :-)
  • DVD_Player_State_Machine (Needs .Net Fx 3.0)

    • This demo uses the state machine representation of a workflow in Windows Workflow Foundation to represent a (not very functional) DVD player and it's various states. It's a great example of transparency at the workflow model level as you can see exactly which states the DVD player can be in, and what causes transitions between them. You'll need a video to play - set the URL property of axWindowsMediaPlayer1 to the video you want to play.
  • TrackingServiceDemo (Needs .Net Fx 3.0 + SQL Server)

    • Nothing to do with the tracking service - this is a persistence service demo (brain malfunction when I named it). There is a project in there that will create 10 workflows and persist them when idled (which will happen when they hit the delay). You can then pull the workflow runtime from under them (by hitting a key) - the console app will exit and take the runtime with it. The other project simpy creates a a workflow runtime and adds the persistence service so you can see those workflows re-loaded and started by a different runtime. You will need SQL Server (as I've used the SqlWorkflowPersistenceService) and you'll need to follow the instructions here to setup the SQL Persistence database:

Technorati tags: windows workflow foundation, demo, rss, vista