Exemplo n.º 1
0
 public static IEnumerable <T> ChooseMany <T>(IWin32Window owner, string prompt, string title, IEnumerable <T> items, string display_member = null)
 {
     using (var dlg = new ListUI {
         Title = title, PromptText = prompt, Items = items.Cast <object>(), SelectionMode = SelectionMode.MultiExtended, DisplayMember = display_member
     })
         return(dlg.ShowDialog(owner) == DialogResult.OK
                                 ? dlg.SelectedItems.Cast <T>()
                                 : Enumerable.Empty <T>());
 }
Exemplo n.º 2
0
 public static T ChooseOne <T>(IWin32Window owner, string prompt, string title, IEnumerable <T> items, string display_member = null)
 {
     using (var dlg = new ListUI {
         Title = title, PromptText = prompt, Items = items.Cast <object>(), SelectionMode = SelectionMode.One, DisplayMember = display_member
     })
         return(dlg.ShowDialog(owner) == DialogResult.OK
                                 ? dlg.SelectedItems.Cast <T>().FirstOrDefault()
                                 : default(T));
 }