Workflow 4.0 designer rehosting with root activity
-
viernes, 16 de octubre de 2009 10:58I am re-hosting wf designer in WPF and showing custom activities in ToolBox. User will select what type of workflow he want to build and select the root activity eaither sequence ot flowchart. I can get the sequence activity window using sequenceDesigner but not found any way to get flowchart activity as a root. How to create custom flowchart activity
Todas las respuestas
-
lunes, 19 de octubre de 2009 18:03ModeradorWhen you create your rehosted designer, what are you passing in to WorkflowDesigner.Load()?
Tim -
miércoles, 21 de octubre de 2009 9:02
to get sequence as a root I am passing (new sequence()) and registering metadata as below code. But when I am trying for flowchart there is no FlowchartDesigner available.
private void RegisterSequenceMetadata()
{
AttributeTableBuilder builder = new AttributeTableBuilder();builder.AddCustomAttributes(typeof(Sequence ),
new DesignerAttribute(typeof(SequenceDesigner )));MetadataStore.AddAttributeTable(builder.CreateTable());
} -
miércoles, 21 de octubre de 2009 20:37Chandra,
Now you just need to call
(new System.Activities.Core.Presentation.DesignerMetadata()).Register()
which will register teh default designers for all of the in the box designers.
If you want to override on top of that, just add your metadata registration after that.
matt
Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle -
jueves, 22 de octubre de 2009 11:59
Thanks Matt
It works. Now I have flowchart designer rehosted in WPF. I can drag and drop my custom activities to create workflow.I need to run the workflow created in re-hosted designer , could you please suggest me the correct approach. In my view I should first persist workflow in database and then run it.
-
jueves, 22 de octubre de 2009 19:32
It depends :-)
You could serialize it out and then run it. If you aren't editing an ActivityBuilder (that is, the root node in your XAML is not <Activity ) you could also grab the activity tree directly and execute it. You could do this from your host by doing the following
myWorkflowDesigner.Context.Services.GetService<ModelService>().Root.GetCurrentValue()
the object returned from that will be your root item, and if that is an activity, you can just execute it.
Note however that if you make any changes to the object direclty, they will not be picked up in the designer (you need to use the ModelItem's in order to do that.
Let me know if that helps,
matt
Program Manager -- wf designer -- http://blogs.msdn.com/mwinkle- Propuesto como respuesta AmyMacMicrosoft Employee, Moderator lunes, 26 de octubre de 2009 21:52

