public static T Select <T>(Action <SelectOptions <T> > configure) { var options = new SelectOptions <T>(); configure(options); return(Select(options)); }
public static T Select <T>(string message, IEnumerable <T> items, int?pageSize = default, object defaultValue = default, Func <T, string> textSelector = default) { var options = new SelectOptions <T> { Message = message, Items = items, DefaultValue = defaultValue, PageSize = pageSize, TextSelector = textSelector ?? (x => x.ToString()) }; return(Select(options)); }
public static T Select <T>(string message, int?pageSize = default, T?defaultValue = default) where T : struct, Enum { var options = new SelectOptions <EnumValue <T> > { Message = message, Items = EnumValue <T> .GetValues(), DefaultValue = (EnumValue <T>)defaultValue, PageSize = pageSize, TextSelector = x => x.DisplayName }; return(Select(options).Value); }
public static T Select <T>(SelectOptions <T> options) { using var form = new SelectForm <T>(options); return(form.Start()); }