locked
How to find the Properties Of an activity In Rehosted Designer RRS feed

  • Question

  • The scenario is that ,i have a rehosted workflow designer and some custom activities,all activities have common base class.While am adding an activity to the RH Designer,i want to find the  type of activity and find all available public properties of that activity to store in  PropertyInfo[].

    Is that possible ??

    Thursday, September 29, 2011 10:36 AM

Answers

All replies

  • Hi RamuNest,

     

    Attach ModelChange Event with your designer ....

    ModelService modelService = wd.Context.Services.GetService<ModelService>();
                modelService.ModelChanged += (obj, arg) => 

    {
     };

    You can write a separate function as well as an handler to MOdelChange Event.

    Here the arg (second argument in the anonymous function ) is ModelChangedEventArgs which gievs you complete information you need.

    Cast the property of ModelChangedEventArgs into your custom class or any class you want ... and access reuired properties.

    Here are some links for more info.

    http://msdn.microsoft.com/en-us/library/system.activities.presentation.services.modelchangedeventargs.aspx

    http://msdn.microsoft.com/en-us/library/system.activities.presentation.workflowdesigner.modelchanged.aspx

    Hope this will help you.

    Regards,


    MB
    • Proposed as answer by MadhurBhardwaj Thursday, September 29, 2011 12:13 PM
    • Unproposed as answer by RamuNeST Thursday, September 29, 2011 1:02 PM
    Thursday, September 29, 2011 12:13 PM
  • arg.propertychaged is getting as null

    my code is

     

    void ms_ModelChanged(object sender, ModelChangedEventArgs

    e)

     

    if (e.ItemsAdded != null

    )

    {

     

    //ModelPropertyEntryToOwnerActivityConverter ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter();

     

    ModelItem activityItem = e.ItemsAdded.ElementAt(0) as ModelItem

    ;

    System.Activities.Statements.

    FlowStep step = activityItem.GetCurrentValue() as System.Activities.Statements.FlowStep

    ;

     

    object activity = step.Action as object

    ;

     

    var objType = activity.GetType();

    //PropertyInfo[] propertyInfos;

     

    //propertyInfos = typeof().GetProperties(BindingFlags.Public);

     

    IccAsyncCodeActivity iccActivity = step.Action as  IccAsyncCodeActivity;

     

    Type

    ty= iccActivity.GetType();

     

    object itemsss=new object

    ();

    itemsss =

    Activator.CreateInstance(Type.GetType(ty.FullName));

     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    here my base class is  IccAsyncCodeActivity,my primary aim is to find the child class,then i want to populate the

    PropertyInfo[] or list the properties in the child activity that i draged in

     
    Thursday, September 29, 2011 1:06 PM
  • Hi,

    How you are attaching event with the workflow designer context ?

    are you doing it like this ?

    ModelService modelService = wd.Context.Services.GetService<ModelService>();

     modelService.ModelChanged += "Your event handler"

    I think it should work.

    Regards,

    Madhur


    MB
    Thursday, September 29, 2011 1:23 PM
  • yes,i am using the modelservice.modelchanged event..
    Friday, September 30, 2011 4:09 AM
  • Hi madhur,

     

     Can we find the activity object in the modelService.ModelChanged  event on editing the activity parameters ie on

    e.propertiesChanged.

    Any Help appreciated..

    Thank You

    Ramu

    Monday, October 3, 2011 4:58 AM
  • Hi,

    PropertiesChanged :-  

    When implemented by a derived class, gets an enumeration of properties that have been changed.

    Please follow this link.

    http://msdn.microsoft.com/en-us/library/system.activities.presentation.services.modelchangedeventargs.propertieschanged.aspx

     

    Regards,

    Madhur


    MB
    • Marked as answer by Andrew_Zhu Thursday, October 6, 2011 6:30 AM
    Monday, October 3, 2011 12:25 PM