/// <summary>
		/// Edits the specified object's value using the editor style
		/// indicated by <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/>.
		/// </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.</returns>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="provider"/> is <see langword="null"/>.</para>
		/// </exception>
		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
		{
			if (provider == null)
			{
				throw new ArgumentNullException("provider");
			}

			string strValue = value as string;

			if (strValue == null)
			{
				return value;
			}

			IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
			
			if (editorService != null)
			{
				NuGenMultilineEditorUI multilineEditor = new NuGenMultilineEditorUI(strValue);
				editorService.DropDownControl(multilineEditor);
				return multilineEditor.GetValue;
			}

			return value;
		}
        /// <summary>
        /// Edits the specified object's value using the editor style
        /// indicated by <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/>.
        /// </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.</returns>
        /// <exception cref="ArgumentNullException">
        /// <para><paramref name="provider"/> is <see langword="null"/>.</para>
        /// </exception>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            string strValue = value as string;

            if (strValue == null)
            {
                return(value);
            }

            IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;

            if (editorService != null)
            {
                NuGenMultilineEditorUI multilineEditor = new NuGenMultilineEditorUI(strValue);
                editorService.DropDownControl(multilineEditor);
                return(multilineEditor.GetValue);
            }

            return(value);
        }
Exemple #3
0
        /// <summary>
        /// Edits the specified object's value using the editor style
        /// indicated by <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/>.
        /// </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.</returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (value.GetType() != typeof(string))
            {
                return(value);
            }

            IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService != null)
            {
                NuGenMultilineEditorUI multilineEditor = new NuGenMultilineEditorUI((string)value);
                editorService.DropDownControl(multilineEditor);

                return(multilineEditor.GetValue);
            }

            return(value);
        }
		/// <summary>
		/// Edits the specified object's value using the editor style
		/// indicated by <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"/>.
		/// </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.</returns>
		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
		{
			if (!(value is string))
			{
				return value;
			}

			IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
			
			if (editorService != null) 
			{
				NuGenMultilineEditorUI multilineEditor = new NuGenMultilineEditorUI((string)value);
				editorService.DropDownControl(multilineEditor);

				return multilineEditor.GetValue;
			}

			return value;
		}