예제 #1
0
        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);
        }
예제 #2
0
        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);
        }