Get input from user with ActivityBuilder in WF 4
Posted
by avi1234
on Stack Overflow
See other posts from Stack Overflow
or by avi1234
Published on 2010-04-13T10:34:40Z
Indexed on
2010/04/13
10:42 UTC
Read the original article
Hit count: 393
Hi, I am trying to write a simple activity that received from the user its name and printing "hello + username" message.
the problem is that i cannot access to the username input via code.
the function is:
static ActivityBuilder CreateTask1()
{
Dictionary<string, object> properties = new Dictionary<string, object>();
properties.Add("User_Name", new InArgument<string>());
var res = new ActivityBuilder();
res.Name = "Task1";
foreach (var item in properties)
{
res.Properties.Add(new DynamicActivityProperty { Name = item.Key, Type = item.Value.GetType(), Value = item.Value });
}
Sequence c = new Sequence();
c.Activities.Add(new WriteLine { Text = "Hello " + properties["User_Name"] });
res.Implementation = c;
return res;
}
The output of the followed will always be "Hello User_Name".
Thanks!
© Stack Overflow or respective owner