CodeActivity & general process
-
2012년 4월 16일 월요일 오후 2:50
I have several code activities, which can be selected in workflow designer (these are exposed to the end users).
But the each of these code activities, must follow some generic logic which I want to define in a custom activity
e.g. (simplified)
if users adds code activity A, workflow should execute
do while
code activity
wait for bookmark
check bookmark result and loop if necessary
how would i do this, without having to design this generic workflow over and over again in designer?
I just want the users to be able to drop a custom activity inside the designer and that it automatically follows the generic logic.
모든 응답
-
2012년 4월 18일 수요일 오전 9:04중재자
Hi,
You can create a configured instance of activity colletions by using your own ActivityTemplateFactory. The code looks like:
using System;
using System.Activities;
using System.Activities.Statements;namespace Microsoft.Samples.IActivityTemplateFactory
{
public sealed class MyFactory: System.Activities.Presentation.IActivityTemplateFactory
{public System.Activities.Activity Create(System.Windows.DependencyObject target)
{
return new DoWhile()
{
Body = new Sequence()
{
Activities = {
new YourCodeActivity()
}
}
};
}
public MyFactory()
{
}
}
}Leo Tang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
2012년 4월 18일 수요일 오전 10:39
Will the whole structure (DoWhile..,Sequence,...) be visible in the designer? I don't want to show the implementation (dowhile etc) in the designer, but I want one activity in the designer (mycodeactivity, which has it's own designer for custom properties and custom arguments), so the user does not have to bother with the implementation...
-
2012년 4월 19일 목요일 오전 9:03중재자
Hi,
->Will the whole structure (DoWhile..,Sequence,...) be visible in the designer?
Yes, the whole structure will be visible in the designer with ActivityTemplateFactory . If you don't want it visible, you'll need to create a custom activity which has its own designer and its own child activities. You can refer to the following sample:
Custom Composite using Native Activity
http://msdn.microsoft.com/en-us/library/dd759031.aspx
Leo Tang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 답변으로 표시됨 LeoTangModerator 2012년 4월 23일 월요일 오전 11:48

