Hendrik Swanepoel

Custom Windows Workflow Foundation IfElseActivity

My requirement for an IfElseActivity was for non coders to use it. Normally an IfElse activity will work based on a Code condition which is specified with code on the workflow.

We allow for business users to manage subsets of systems using an embedded workflow editor we provide for their use. Obviously we can't tell our business user to "just learn some simple csharp".. I wanted to have an IfElseActivity where you can use activities with "return values" as checks on the IfElse branch, meaning the user will drag on an IfElse activity and on the one branch drag on other special activities which will determine whether the branch should be executed.

I ended up writing an IfElseActivity that looks like this:

Each branch contains two activities, a condition preview activity and an execution block activity. To implement a new check, implement from the IConditionActivity in the project which exposes an Evaluation property and a Negated property.

The IfElseActivity will execute your check and then decide whether it will continue to the next check based on the Evaluation property you implemented. All the checks associated with the branch's condition preview needs to pass before the branch will execute. You can also negate the check, meaning the check needs to return false in order for it to pass.

You can then proceed in dragging the activities you want to execute in the branch onto the Execution activity. I did this for branch 1 with a code activity. If the first branch does not pass, it will proceed to the next branch. You can also have more than two branches.

Download the solution and have a look: http://novarank.com/customifelse.zip

[Update:] You need to install netfx3 and the latest version of vs.net extensions for windows workflow.

Comments

Maulik said:

Very few people try to make it usable for business users. I am very excited to look at the code, Can you correct code download link or email me. Its mmodi AT solu-soft DOT com

# July 27, 2007 9:33 PM

Swetha said:

To test

# August 23, 2007 12:07 PM

Swetha said:

To test

# August 23, 2007 12:07 PM

Tim Mies said:

The .zip seems to be down. Where can I get it?

Greetings from Germany!

# February 13, 2008 2:10 PM

vladimir said:

please, check download link customifelse.zip, it seems to be broken :(

# April 23, 2008 3:28 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: