/// <summary>
        /// Edits the specified object's value using the editor style indicated by the GetEditStyle method.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
        /// <param name="provider">An 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, IServiceProvider provider, object value)
        {
            // Get associated items list
            NuGenUIItemCollection uiItemCollection = value as NuGenUIItemCollection;
            Collection <object>   associatedItems  = new Collection <object>();

            foreach (object item in uiItemCollection)
            {
                associatedItems.Add(item);
            }

            // Get command switchboard
            NuGenApplicationCommand command       = uiItemCollection.ApplicationCommand;
            NuGenCommandManagerBase UISwitchboard = command.CommandManager;

            // Get available items list
            Collection <object> availableItems = new Collection <object>();

            foreach (object item in UISwitchboard.UIItemAdapter.GetAvailableUIItems())
            {
                availableItems.Add(item);
            }

            // Get editor service
            IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService != null)
            {
                // Show form
                NuGenUIItemsForm formUIItems = new NuGenUIItemsForm(command, associatedItems, availableItems);
                if (editorService.ShowDialog(formUIItems) == DialogResult.OK)
                {
                    NuGenUIItemCollection modifiedUIItemCollection = new NuGenUIItemCollection(command);
                    foreach (Object item in associatedItems)
                    {
                        modifiedUIItemCollection.Add(item);
                    }
                    return(modifiedUIItemCollection);
                }
            }
            return(value);
        }
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by the GetEditStyle method.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
        /// <param name="provider">An 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, IServiceProvider provider, object value)
        {
            // Get associated items list
            NuGenUIItemCollection uiItemCollection = value as NuGenUIItemCollection;
            Collection<object> associatedItems = new Collection<object>();
            foreach (object item in uiItemCollection)
            {
                associatedItems.Add(item);
            }

            // Get command switchboard
            NuGenApplicationCommand command = uiItemCollection.ApplicationCommand;
            NuGenCommandManagerBase UISwitchboard = command.CommandManager;

            // Get available items list
            Collection<object> availableItems = new Collection<object>();
            foreach (object item in UISwitchboard.UIItemAdapter.GetAvailableUIItems())
            {
                availableItems.Add(item);
            }

            // Get editor service
            IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService != null)
            {
                // Show form
                NuGenUIItemsForm formUIItems = new NuGenUIItemsForm(command, associatedItems, availableItems);
                if (editorService.ShowDialog(formUIItems) == DialogResult.OK)
                {
                    NuGenUIItemCollection modifiedUIItemCollection = new NuGenUIItemCollection(command);
                    foreach (Object item in associatedItems)
                    {
                        modifiedUIItemCollection.Add(item);
                    }
                    return modifiedUIItemCollection;
                }
            }
            return value;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NuGenApplicationCommand"/> class.
 /// </summary>
 public NuGenApplicationCommand()
 {
     uiItems = new NuGenUIItemCollection(this);
 }