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("Отменено пользователем"); }
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("Отменено пользователем"); }