Subclassing StateActivity

I am trying to create a special subclass ofStateActivity which creates a user-assigned task entry in a database table when it becomes the current state, and the closes the task in the database when it ceases to be the current state.

This way my workflow creates a database entry for a user to say "do this task please" and also closes the task if workflow is completed, cancelled etc.

So far I haveStateWithTaskActivity which captures theExecute andOnClosed events to create and close the task, which works ok.

I would like to be able to let a workflow designer initialize some of the properties of the activity just before it creates the task, in the same way as theDelayActivity propertyInitializeTimeoutDuration- how does one create a dependency property that generates a function?

Note that I can't let the user use StateInitialization activities because the task is createdbefore this is called.

Here's hoping someone can suggest how..

[1077 byte] By [HowardRichards] at [2007-12-24]
# 1

You can define a dependecy property of type event handler like this:

public MyActivity: Activity
{
public static readonly DependencyProperty TestEvent = DependencyProperty.Register("Test", typeof(EventHandler), typeof(MyActivity));

public event EventHandler Test
{
add
{
base.AddHandler(TestEvent, value);
}
remove
{
base.RemoveHandler(TestEvent, value);
}
}

}

VishalKalra at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2
Works a treat, many thanks
HowardRichards at 2007-10-8 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified