locked
custom flowdecision RRS feed

  • Question

  • Hello,

    I have a question regarding workflow flowdecision on flowchart.
    Does anyone know if there is posibility to set Condition(for me it will be bool variable) to flowdesision contronl when i drag and drop it to flowchat?
    Or is it possible to create custom flowdesision activity somehow, which works like flowdesision but allows me to put condition in code?
    thank you in advance for your help

    Thursday, June 17, 2010 10:50 AM

Answers

  • I was trying to get expression like that:

     

     

    Argument myArg =
    Argument.Create(typeof(bool), ArgumentDirection.In); myArg.Expression = new VisualBasicValue<bool>
    {
    ExpressionText =
    "variable1"
    };

    But it cant by in/out argument it have to be Systems.Activitis.Activity , does anyone knows how can I create such thing?

     I am able to do somteting like this:
    item.Properties["Condition"].ComputedValue = (Activity<bool>)false;
    or
    item.Properties["Condition"].SetValue((Activity<bool>)false);

    And it works, it sets my flowdecision to false/true when I drag and drop it to flowchart, but I need a value of my predefined flowchart variable, and I can't find a way to convert it;/ Please help 

    ----
    Ok I've got it

     

     

    Activity<bool> variable = new VisualBasicValue<bool> { ExpressionText = "variableName" };

    Anyway, thank you for previous answers, were very helpful, Thanks.

    • Marked as answer by paras21 Sunday, June 20, 2010 1:15 PM
    Saturday, June 19, 2010 7:31 PM

All replies

  • Hi,

    I'm not sure whether I misunderstood your question. But FlowDesicion by default has a bool property named "Condition", and based on the value of this condition, it branches into "true" and "false".

    From designer, you can set expression to this property from property grid.

    Regards,

    Panda 


    This posting is provided "AS IS" and confers no rights or warranties.
    Friday, June 18, 2010 6:34 PM
  • Does anyone know if there is posibility to set Condition(for me it will be bool variable) to flowdesision contronl when i drag and drop it to flowchat?

    there is a event named BeforeDrop or similar, and you can set the condition value in this event.

    Friday, June 18, 2010 9:13 PM
  • Thanky you for your reply

    there is a event named BeforeDrop or similar, and you can set the condition value in this event.

    I'm not sure how can i get to this event, I created toolbox in rehosted designer with flowcondition, few other standard activities, and few my custom activities. I was trying to find a way to get events, but unfortunatelly i didn't find solution. Could you give me a tips how to do this?
    Thanks

    Saturday, June 19, 2010 12:01 PM
  • Hello, at the moment I found something like this:

    _workflowDesigner.Context.Services.GetService<

     

    ModelService>().ModelChanged += new EventHandler<ModelChangedEventArgs>(_workflowDesigner_ModelChanged);}
    void _workflowDesigner_ModelChanged(object sender, ModelChangedEventArgs e)
    {
    if (e!=null && e.ItemsAdded !=null)
    foreach (ModelItem item in e.ItemsAdded)
    {
    if (item.ItemType == typeof(FlowDecision))
    {
    item.Properties[
    "Condition"].SetValue("variableName");
    }}

    unfortunatelly there is an error because I cant set string as condition, and I need string because I would like to name it as my variable name, what type should i use? Any suggestions? Thank you

    Saturday, June 19, 2010 6:38 PM
  • I was trying to get expression like that:

     

     

    Argument myArg =
    Argument.Create(typeof(bool), ArgumentDirection.In); myArg.Expression = new VisualBasicValue<bool>
    {
    ExpressionText =
    "variable1"
    };

    But it cant by in/out argument it have to be Systems.Activitis.Activity , does anyone knows how can I create such thing?

     I am able to do somteting like this:
    item.Properties["Condition"].ComputedValue = (Activity<bool>)false;
    or
    item.Properties["Condition"].SetValue((Activity<bool>)false);

    And it works, it sets my flowdecision to false/true when I drag and drop it to flowchart, but I need a value of my predefined flowchart variable, and I can't find a way to convert it;/ Please help 

    ----
    Ok I've got it

     

     

    Activity<bool> variable = new VisualBasicValue<bool> { ExpressionText = "variableName" };

    Anyway, thank you for previous answers, were very helpful, Thanks.

    • Marked as answer by paras21 Sunday, June 20, 2010 1:15 PM
    Saturday, June 19, 2010 7:31 PM