Ejemplo n.º 1
0
        public static IEnumerable <T> MultiSelect <T>(Action <MultiSelectOptions <T> > configure)
        {
            var options = new MultiSelectOptions <T>();

            configure(options);

            return(MultiSelect(options));
        }
Ejemplo n.º 2
0
        public static IEnumerable <T> MultiSelect <T>(string message, IEnumerable <T> items, int?pageSize = null, int minimum = 1, int maximum = -1, IEnumerable <T> defaultValues = null, Func <T, string> textSelector = null)
        {
            var options = new MultiSelectOptions <T>
            {
                Message       = message,
                Items         = items,
                DefaultValues = defaultValues,
                PageSize      = pageSize,
                TextSelector  = x => x.ToString()
            };

            return(MultiSelect(options));
        }
Ejemplo n.º 3
0
        public static IEnumerable <T> MultiSelect <T>(string message, IEnumerable <T> items, int?pageSize = default, int minimum = 1, int maximum = int.MaxValue, IEnumerable <T> defaultValues = default, Func <T, string> textSelector = default)
        {
            var options = new MultiSelectOptions <T>
            {
                Message       = message,
                Items         = items,
                DefaultValues = defaultValues,
                PageSize      = pageSize,
                Minimum       = minimum,
                Maximum       = maximum,
                TextSelector  = textSelector ?? (x => x.ToString())
            };

            return(MultiSelect(options));
        }
Ejemplo n.º 4
0
        public static IEnumerable <T> MultiSelect <T>(string message, int?pageSize = default, int minimum = 1, int maximum = int.MaxValue, IEnumerable <T> defaultValues = default) where T : struct, Enum
        {
            var options = new MultiSelectOptions <EnumValue <T> >
            {
                Message       = message,
                Items         = EnumValue <T> .GetValues(),
                DefaultValues = defaultValues?.Select(x => (EnumValue <T>)x),
                PageSize      = pageSize,
                Minimum       = minimum,
                Maximum       = maximum,
                TextSelector  = x => x.DisplayName
            };

            return(MultiSelect(options).Select(x => x.Value));
        }
Ejemplo n.º 5
0
        public static IEnumerable <T> MultiSelect <T>(MultiSelectOptions <T> options)
        {
            using var form = new MultiSelectForm <T>(options);

            return(form.Start());
        }