Read from some article(s), that the Parallel Activity doesn't execute the child activities in different threads until and unless the child activities themselves are asynchronous. So I just built a custom AsyncCodeActivity named AsyncTask which has an Activity(named SyncActivity) as InArgument and within the BeginExecute I call Task.Factory.StartNew(() => WorkflowInvoker(SyncActivity)). But I also want a designer which would look exactly similar to the Parallel Activity and have same functionalities(like dragging some activity and putting it in one of the branches) as Parallel Activity.But when some Activity is dragged and dropped into one of the branches, it should internally run asynchronously using the AsyncTask AsyncActivity. How do I do that?
I understand your problem. Building an activity designer (control in WF) is not that hard. Just use the WorkflowItemPresenter like shown on MSDN.
To fulfill your further requirements we have to keep in mind that activities take parameters. You have to pass them to your SyncActivity through the outer AsyncActivity. Therefore you have to enhance your activity designer by dynamically created input controls. To create those you need to access the public properties of your SyncActivity (e. g. by Reflection). I found it hard to even access the inner activity, because you have to work yourself through a so called "ModelItem". An easier approach might be passing the parameters by creating a chain of variables.
And by the way: The task factory helps you creating tasks, but it doesn't force the creation of new threads. Just keep the task/thread model in mind ;-)
Regards Jan