using Elsa.Extensions; using Elsa.Workflows; using Elsa.Workflows.Attributes; using Elsa.Workflows.Models; using Elsa.Workflows.UIHints; namespace Elsa.Samples.AspNet.WorkflowServer.Activities; /// /// This activity shows how to provide default values for inputs. /// [Activity("Demo", "Demo", Description = "A demo activity with default settings.")] public class MyActivity : CodeActivity { [Input(DefaultValue = "Hello World!")] public Input Message { get; set; } = default!; [Input(DefaultValue = true)] public Input Toggle { get; set; } = default!; [Input(DefaultValue = "B", Options = new[] { "A", "B", "C" }, UIHint = InputUIHints.DropDown)] public Input SelectedOption { get; set; } = default!; [Input(DefaultValue = new[] { "C#", "Programming" }, UIHint = InputUIHints.MultiText)] public Input Tags { get; set; } = default!; [Input(DefaultValue = "B", Options = new[] { "A", "B", "C" }, UIHint = InputUIHints.RadioList)] public Input SelectedRadioOption { get; set; } = default!; [Input(DefaultValue = new[] { "A", "C" }, Options = new[] { "A", "B", "C" }, UIHint = InputUIHints.CheckList)] public Input SelectedCheckOption { get; set; } = default!; protected override void Execute(ActivityExecutionContext context) { var message = Message.Get(context); var toggle = Toggle.Get(context); var selectedOption = SelectedOption.Get(context); var tags = Tags.Get(context); var selectedRadioOption = SelectedRadioOption.Get(context); var selectedCheckOption = SelectedCheckOption.Get(context); Console.WriteLine(message); Console.WriteLine("Toggle: {0}", toggle); Console.WriteLine("Selected option: {0}", selectedOption); Console.WriteLine("Tags: {0}", string.Join(", ", tags)); Console.WriteLine("Selected radio option: {0}", selectedRadioOption); Console.WriteLine("Selected check option: {0}", string.Join(", ", selectedCheckOption)); } }