Search code examples
c#xamlandroid-activityworkflow-foundation-4

Using assigned variable to an InArgument<>


I want to use an InArgument parameter in my Activity. I use an expressionTextBox to showing and using the InArgument value in XAML code. My problem is this I declare a variable and assign it to this expressiontextbox in Activity Library designer. When in the Execute() method of the activity, I change the value of InArgument parameter - I want the variable value to change too. How can I do it?

My code is like this...

...
public InArgument<string> AcceptedForms{ get; set; }
...

protected override void Execute(CodeActivityContext context)
{
    ...
    string AForms= "#AcceptedForms_"+ this.Id;

    AcceptedForms.Set(context, AForms);
    ...
}

I can use the value of AcceptedForms in this method after changing it's value. But it doesn't pass to the variable that I assign to it in Activity Library Designer. I want to use it's value in another Activity.


Solution

  • You won't be able to do that because when they are passed into the WF runtime I don't think they are passed by reference. So, what you'll have to do is setup an OutArgument that you set while in the Execute method and set that OutArgument -- in the workflow -- to the variable.

    UPDATE

    If you can take 15 minutes and watch this video I think you'll better understand what's going on. And BTW, below is the entire list of videos in this series, it's an amazing foundation on these types of things.