I built a little sample with WF the other week for an internal group meeting just as a bit of fun to try and illustrate (to people who are not developers) what Workflow Foundation can enable.
I thought I'd share the bits here. Essentially, it's a small sample which includes some of;
- Hosting the WF Runtime
- Hosting the WF Designer
- Dynamically creating and running a WF that was just designed
- Building Activities to perform domain-specific tasks
- Building Services to support those Activities built in (4) and adding them to the runtime.
The code's pretty hacky to be honest as I didn't spend a lot of time on it.
The essential idea is to get someone without developer knowledge to build this WPF "application";
all the application does is to create a new Window and then randomly create a number of shapes (triangle, rectangle, etc) in a random number of colours, draw them at random locations on the screen and then make them spin.
After it's created the necessary number of shapes, it waits for a while and then it exits.
The way in which this "program" is built is by using another program that hosts the WF designer. That program is as below.
The essential flow for this is that a user comes along and just drags and drops the components from the right hand side onto the design surface (they're listen in the right order) to build;
which just says;
- Create Window.
- Repeat N Times.
- Create Random Shape.
- Create Random Point.
- Create Random Colour.
- Draw a Shape using the random shape, point, colour just created (this needs ActivityBinds) in steps 3, 4 and 5.
- Spin the Shape that we just drew (this needs ActivityBinds) in step 6.
- Pause for a little while (say 1 second).
- Pause for a while (well as long as you want the program to keep running - say 1 minute).
- Close the Window.
The only "tricky" bits are in steps 6 and step 7 where you have to do Activity binds in order to;
- Bind the Point, ShapeType, Colour on the DrawShape activity to the right properties from the RandomShape, RandomColour, RandomPoint activities.
- Bind the Shape property on the SpinShape to the Shape property on the DrawShape activity.
The properties dialog after step (1) would look like;
Here's the sample code if you want to play with it.
Posted
Wed, Dec 13 2006 5:21 AM
by
mtaulty