Ejemplo n.º 1
0
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information.</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns>
        /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
        /// </returns>
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            VideoSourceType videoSource = new VideoSourceType();
            videoSource = value as VideoSourceType;
            if (svc != null)
            {
                using (VideoSourceForm form = new VideoSourceForm())
                {
                    form.Value = videoSource;
                    if (svc.ShowDialog(form) == DialogResult.OK)
                    {
                        videoSource = form.Value; // update object
                    }
                }
            }

            return videoSource; // can also replace the wrapper object here
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/> method.
        /// </summary>
        /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that can be used to gain additional context information.</param>
        /// <param name="provider">An <see cref="T:System.IServiceProvider"/> that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns>
        /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed.
        /// </returns>
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService svc         = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
            VideoSourceType            videoSource = new VideoSourceType();

            videoSource = value as VideoSourceType;
            if (svc != null)
            {
                using (VideoSourceForm form = new VideoSourceForm())
                {
                    form.Value = videoSource;
                    if (svc.ShowDialog(form) == DialogResult.OK)
                    {
                        videoSource = form.Value; // update object
                    }
                }
            }

            return(videoSource); // can also replace the wrapper object here
        }