예제 #1
0
        public static List <T> SelectMany <T>([NotNull] List <SelectListItem <T> > items, string title, [CanBeNull] string name = null)
        {
            var selVM   = new SelectListVM <T>(items, title, name, true);
            var selView = new SelectListView(selVM);

            if (selView.ShowDialog() == true)
            {
                return(selVM.MultiSelected.Select(s => s.Object).ToList());
            }

            throw new OperationCanceledException("Отменено пользователем");
        }
예제 #2
0
        public static T Select <T>([NotNull] List <SelectListItem <T> > items, [CanBeNull] SelectListItem <T> selected,
                                   string title, [CanBeNull] string name = null)
        {
            var selVM = new SelectListVM <T>(items, title, name)
            {
                Selected = selected ?? items[0]
            };
            var selView = new SelectListView(selVM);

            if (selView.ShowDialog() == true)
            {
                return(selVM.Selected.Object);
            }

            throw new OperationCanceledException("Отменено пользователем");
        }