コード例 #1
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    if (_mappingPropertyEditorForm == null)
                    {
                        _mappingPropertyEditorForm = new MappingPropertyEditorForm();
                    }

                    _mappingPropertyEditorForm.Start(editorService, value);
                    editorService.ShowDialog(_mappingPropertyEditorForm);

                    if (_mappingPropertyEditorForm.DialogResult == DialogResult.OK)
                    {
                        MappingProperty mappingProperty = new MappingProperty();
                        mappingProperty.MappingInfoCollection = _mappingPropertyEditorForm.MappingInfoCollection;
                        value = mappingProperty;
                    }
                    else
                    {
                        value = null;
                    }
                }
            }

            return value;
        }
コード例 #2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    if (_mappingPropertyEditorForm == null)
                    {
                        _mappingPropertyEditorForm = new MappingPropertyEditorForm();
                    }

                    _mappingPropertyEditorForm.Start(editorService, value);
                    editorService.ShowDialog(_mappingPropertyEditorForm);

                    if (_mappingPropertyEditorForm.DialogResult == DialogResult.OK)
                    {
                        MappingProperty mappingProperty = new MappingProperty();
                        mappingProperty.MappingInfoCollection = _mappingPropertyEditorForm.MappingInfoCollection;
                        value = mappingProperty;
                    }
                    else
                    {
                        value = null;
                    }
                }
            }

            return(value);
        }