开发者

Custome activity buid by an activity file

How can I use custom code (activity file not codeactivity neither activitydesginer ) as an Activity inside a Reshosted workflow designer?

I was doing the following for any activity, which I build for each ( codeactivity & activitydesginer) files, and wirte:

            new ToolboxCategory("new Toolbox")
                {                        
                   Too开发者_如何学运维ls=
                   {
                        new ToolboxItemWrapper(typeof(Flowchart)),
                        new ToolboxItemWrapper(typeof(SimpleWebDesigner.TEST)),

....etc

AnyHelp?


If you're talking about loading an Activity loaded from a loose xaml file, you can do this.

You have to use the the ActivityXamlServices class to Load(filename) the file at runtime. When you do this, you get the deserialized Activity instance. Of course, you must have any relevant assemblies (any assembly referenced by Activities defined in the xaml file) either loaded in the AppDomain or available for loading where the Fusion loader can find them.

Once you do this, you can create a ToolboxItemWrapper passing in activityInstance.GetType().

One thing, since the Activity xaml file is an Activity which holds other Activities, you will get the default Designer, which only shows a blank header. There is no easy way* to expand the child Activities defined in the xaml file in the designer when you drop them on the design surface.

*I believe you can construct a class that implements IActivityTemplateFactory which you can pass to the ToolboxItemWrapper which can pass the root Activity defined within your xaml file, so that when you drag/drop the item from the toolbox it will automatically add all child Activities defined in the xaml file. But I've never done this and am not sure if you can.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜