开发者

Show an activity into the designer?

I've a sample workflow application, which only have to display an activity an show on which step we are.

The problem is that when I load my activity like this:

TestWorkflow workflow = new TestWorkflow();
_workflowApplication= new WorkflowApplication(workflow );
_workflowDesigner = new WorkflowDesigner();
_workflowDesigne开发者_运维技巧r.Load(workflow );
uxGridWorkflowHoster.Children.Add(_workflowDesigner.View);

I'm getting only the root element "sequence" in my box. how to change that?

I get that on visual studio

Show an activity into the designer?

And in my app, I see only that:

Show an activity into the designer?

Thank you!


The problem is that TestWorkflow doesn't have a designer associated with it, and the design surface doesn't realize that TestWorkflow is an Activity that is composed out of other activities, and it should display the root of its implementation rather than the TestWorkflow activity itself.

I don't know the best way to deal with this, but I've used the following hack. It gets the first activity (the root) of TestWorkflow and wraps it in an ActivityBuilder.

var rootActivity = WorkflowInspectionServices
                       .GetActivities(new TestWorkflow())
                       .FirstOrDefault();

var builder = new ActivityBuilder
              {
                  Implementation = rootActivity,
                  //Name = PartType.Name (whoops, should have cut that out)
              };
_workflowDesigner.Load(builder);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜