Exemplo n.º 1
0
        /// <summary>
        /// Takes care of displaying the modal window to edit the current value.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService =
                    provider.GetService(
                        typeof(IWindowsFormsEditorService))
                    as IWindowsFormsEditorService;
            }

            if (editorService != null)
            {
                if (value != null)
                {
                    using (MSDataGridHelperDesignerModalView selectionControl = new MSDataGridHelperDesignerModalView((MSDataGridHelperLayoutInfo)value))
                    {
                        if (editorService.ShowDialog(selectionControl) == DialogResult.OK)
                        {
                            value = selectionControl.gridInfo;
                        }
                    }
                }
            }

            return(value);
        }
        /// <summary>
        /// Takes care of displaying the modal window to edit the current value.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                editorService =
                    provider.GetService(
                    typeof(IWindowsFormsEditorService))
                    as IWindowsFormsEditorService;
            }

            if (editorService != null)
            {
                if (value != null)
                {
                    using (MSDataGridHelperDesignerModalView selectionControl = new MSDataGridHelperDesignerModalView((MSDataGridHelperLayoutInfo)value))
                    {
                        if (editorService.ShowDialog(selectionControl) == DialogResult.OK)
                            value = selectionControl.gridInfo;
                    }
                }
            }

            return value;
        }