Is this possible? I know it is for MS since they have WF activity packs but I'm not sure how it's done. It would be nice to be able to have Activities with Body blocks to insert other activities, buttons, etc. If not too much trouble and/or time consuming that is.
相关问题
- IPAddress.[Try]Parse parses 192.168 to 192.0.0.168
- WF4 InstancePersistenceCommand interrupted
- Lookup Class In LINQ, What is the underlying data
- Get Types defined in an assembly only [duplicate]
- The new IntPtr.Add method - am I missing the point
相关文章
- Forcing a TFS2010 workflow build to FAIL instead o
- Contributing using git
- Publish is not transforming web.config?
- Default for generic type? [duplicate]
- Cast List of Anonymous type to List of Dynamic Obj
- Replace relative urls to absolute
- Rehosted Microsoft Workflow Designer UI
- Sign data using smart card's private key with
You need to start with a NativeActivity instead of a CodeActivity. The NativeActivity lets you schedule child activities through its execution context. There is no template for the NativeActivity, instead you just create a class and derive from NativeActivity.
The Pro WF : Windows Workflow in .Net 4 book by Bruce Bukovics also has lots of examples. You might want to check that out.
Its easy enough if you follow a few rules. Here's an example of a NativeActivity that has a child:
Note a few things: We use an Activity Delegate type to hold our child. Second, we implement IActivityTemplateFactory to configure our activity for the designer. Its always better/more stable to do this than set stuff up in the constructor. We will be binding to a property of the delegate, so we have to set an instance; otherwise the binding will fail.
When we execute, all you have to do is schedule your child when appropriate and return. You shouldn't block, of course.
Then, in the designer, you'd bind to Child like this: