Custom/Preconfigured StateActivity

DI am trying to create a custom StateActivity. This activity should have a default StateInitializationActivity and three predefined EventDrivenActivities. (The state represents a page in a workflow driven wizard-like dialogue. The EventActivites are BackButtonClicked, NextButtonClicked and CancelClicked. I realy do not want the user to have to assemble all nessesary activities for each page on its own. Especially if only few properties of the state are of interest for him (template to use, parameters to pass and next state depending on the button clicked).

I use the CreateComponentsCore function of my own derived ActivityToolboxItem class to create the SubActivites of my custom StateActivty.

So far anything is working just fine. But i have a problem generating the CorrelationTokens for the activities. The StateDesigner seems to assign a new name to all activities after they have been added to the workflow.

I helped my self by creating unique names like "MyState_01223332" (from DateTime.Now.Tickcount). But as soon as a user renames the activity all relations within the children are rendered usless (and users most probably want to change ugly names like this to more meaningfull ones).

I tried my own designer and override the OnActivityChange method. Works fine, but has the huge drawback that the StateDesigner is interneal and sealed. So my designer inherits from CompositeActivityDesigner and does not realy behave as a designer for a StateActivtiy should. And i realy do not want to copy the whole thing (seems to be pretty complex).

Does anyone have an idea how to handle this scenario
Why is the StateDisigner hidden from users How am I supposed to create custom StateActivities

Thanks,
Cadi




Answer this question

Custom/Preconfigured StateActivity

  • Babau

    The issue Cadi was having was related to binding and was not realy specific to a custom state activity:

    cadi wrote:

    So far anything is working just fine. But i have a problem generating the CorrelationTokens for the activities. The StateDesigner seems to assign a new name to all activities after they have been added to the workflow.

    I helped my self by creating unique names like "MyState_01223332" (from DateTime.Now.Tickcount). But as soon as a user renames the activity all relations within the children are rendered usless (and users most probably want to change ugly names like this to more meaningfull ones).



  • TheBC

    Tom, what does binding have to do with being able to customize stateactivity designer, can you elaborate It would have been nice not to have to make a designer for it from scratch, why was the StateDesigner sealed


  • REasley

    Hi,
    I would also be interrested to know how to do this. In an ideal world, when you derive a new activity from StateActivity, the designer would allow to drop initializers and events similar to the composite activity designer.

    Charles

  • kef_c80

    Take a look at this post on using /Self and /Parent.

  • Custom/Preconfigured StateActivity