internal ComplexTypePickerDialog(ConceptualEntityModel cModel)
        {
            InitializeComponent();

            // Set the default font to VS shell font.
            var vsFont = VSHelpers.GetVSFont(Services.ServiceProvider);
            if (vsFont != null)
            {
                Font = vsFont;
            }

            Debug.Assert(cModel != null, "Please specify ConceptualEntityModel");
            if (cModel != null)
            {
                var complexTypes = new List<ComplexType>(cModel.ComplexTypes());
                complexTypes.Sort(EFElement.EFElementDisplayNameComparison);
                complexTypesListBox.Items.AddRange(complexTypes.ToArray());
                ViewUtils.DisplayHScrollOnListBoxIfNecessary(complexTypesListBox);
            }

            complexTypesListBox.SelectedIndexChanged += complexTypesListBox_SelectedIndexChanged;
            complexTypesListBox.MouseDoubleClick += complexTypesListBox_MouseDoubleClick;
            okButton.Enabled = ComplexType != null;
        }
        private static EntityDesignNewFunctionImportResult ShowNewFunctionImportDialog(
            Function selectedSproc,
            string selectedSprocName,
            StorageEntityModel sModel,
            ConceptualEntityModel cModel,
            ConceptualEntityContainer cContainer,
            string dialogTitle,
            Object selectedObject)
        {
            using (var dialog = new NewFunctionImportDialog(
                selectedSproc,
                selectedSprocName,
                sModel.Functions(),
                cModel.ComplexTypes(),
                cModel.EntityTypes(),
                cContainer,
                selectedObject))
            {
                dialog.Text = dialogTitle;

                var dialogResult = dialog.ShowDialog();

                var result = new EntityDesignNewFunctionImportResult
                    {
                        DialogResult = dialogResult,
                        Function = dialog.Function,
                        FunctionName = dialog.FunctionImportName,
                        IsComposable = dialog.IsComposable,
                        ReturnType = dialog.ReturnType,
                        Schema = dialog.Schema
                    };

                return result;
            }
        }