forked from elsa-workflows/elsa-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VehicleUIHandler.cs
25 lines (21 loc) · 781 Bytes
/
VehicleUIHandler.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System.Reflection;
using Elsa.Workflows.UIHints.Dropdown;
namespace Elsa.Samples.AspNet.CustomUIHandler;
/// <summary>
/// A custom dropdown options provider to provide vehicle options for the Brand property of <see cref="VehicleActivity"/>.
/// </summary>
public class VehicleUIHandler : DropDownOptionsProviderBase
{
private readonly Random _random = new();
protected override ValueTask<ICollection<SelectListItem>> GetItemsAsync(PropertyInfo propertyInfo, object? context, CancellationToken cancellationToken)
{
var items = new List<SelectListItem>
{
new("BMW", "1"),
new("Tesla", "2"),
new("Peugeot", "3"),
new(_random.Next(100).ToString(), "4")
};
return new(items);
}
}