private int ShowPopup(IList items) { int result = -1; ListBoxForm popup = new ListBoxForm(); ListBoxOptionsController popupController = new ListBoxOptionsController(popup, items); popupController.LoadView(); DialogResult dialogResult = popup.ShowDialog(); if (dialogResult == DialogResult.OK) { result = popupController.SelectedIndex; } return(result); }
public static Item ShowListBoxOptionsForm(IList items, Control parentControl) { Item result = new Item(); ListBoxForm popup = new ListBoxForm(); ListBoxOptionsController popupController = new ListBoxOptionsController(popup, items); popupController.LoadView(); DialogResult dialogResult = popup.ShowDialog(parentControl); if (dialogResult == DialogResult.OK) { result = popupController.SelectedItem; } popup.Dispose(); return(result); }