More simplistic conditions and branches
IfElse is fine, but we would like a very simple YesNo container that branches based on a property value of the preceding activity. Any suggestions on how this might be implemented? Is it possible to determine the task immediately before your task? What steps are required to present a drop-down list of the available boolean properties on the preceding task? We could use reflection and build our own custom UITypeEditor, but I know the EventSink does something similar so there must already be a facility for such a drop-down.Thanks again!
I'm not clear on what you want to accomplish. Can you give me an example?
I assume that you are referring to activities. You can navigate through the activities from within a custom activity. For example, in an activity's you can get a reference to the parent's activities collection: this.Parent.Activities. You can implement a drop-down list of values, similiar to what you see with the event names ont he EventSink activity, by defining a TypeConvertor. The Sql Server Database Activity here on the WindowsWorkflow.net community site shows how to implement a type convertor with a drop-down list of values. Take a look at the CommandText property.
James Conard
Architect Evangelist - Windows Workflow Foundation
http://www.WindowsWorkflow.net
http://blogs.msdn.com/jamescon
Your answer helped us in other areas, but my question was not clear because it was probably the wrong thing to ask.Basically, we wanted something like an IfElse that only had two branches (a Yes branch and a No branch). The branch taken would depend on a property value of the proceeding activity. I managed to implement it tonight.
Using IfElse as an example, I made a YesNoActivity that derived from CompositeActivity. I then made a YesBranch and a NoBranch based on Sequence. Next, I made a YesNoToolboxItem that added one YesBranch and one NoBranch to the YesNoActivity at creation time. I added a boolean property to the YesNoActivity called Evaluation, and the Executor code chooses whether to run the YesBranch or the NoBranch based on the Evaluation property.
My earlier question was how to hook our Evaluation property up to the property of the proceeding task. This is easy to do, but for some reason I wasn't seeing the <Activity Reference...> option in the drop-down list. It must have been while I was messing with the dependant properties.
Thanks for the help. I think we have all we need! If anyone thinks they might use this activity, I'll see if I can get the OK to upload it.
Jared Bienz wrote: |
| but for some reason I wasn't seeing the <Activity Reference...> option in the drop-down list. It must have been while I was messing with the dependant properties.
|
|
Yes, properties have to be dependency properties in order to support data binding and show the <Activity Reference...> option in the drop-down list.
James Conard
Architect Evangelist - Windows Workflow Foundation
http://www.WindowsWorkflow.net
http://blogs.msdn.com/jamescon