Example #1
0
        /// <summary>
        /// Initialize a new instance of the <see cref="NodeCreationEntry"/> with a command, the node type to create, the configuration data type associated with the node, name to display for this node, and if there can be more than one node of the type.
        /// </summary>
        /// <param name="configurationNodeCommand">The <see cref="ConfigurationNodeCommand"/> used to create the node.</param>
        /// <param name="nodeType">The <see cref="Type"/> of the node to create.</param>
        /// <param name="dataType">The <see cref="Type"/> of the configuration data associated with the <paramref name="nodeType"/>.</param>
        /// <param name="displayName">The name to display in the user interface to create the node.</param>
        /// <param name="allowMultiple">
        /// Determines if more than one of the node type can exist.
        /// </param>
        private NodeCreationEntry(ConfigurationNodeCommand configurationNodeCommand, Type nodeType, Type dataType, string displayName, bool allowMultiple)
        {
            if (null == configurationNodeCommand)
            {
                throw new ArgumentNullException("configurationNodeCommand");
            }
            if (null == nodeType)
            {
                throw new ArgumentNullException("nodeType");
            }
            if (null == dataType)
            {
                throw new ArgumentNullException("dataType");
            }
            if (string.IsNullOrEmpty(displayName))
            {
                throw new ArgumentException(Resources.ExceptionStringNullOrEmpty, "displayName");
            }

            this.configurationNodeCommand = configurationNodeCommand;
            this.allowMultiple            = allowMultiple;
            this.nodeType = nodeType;
            if (!typeof(ConfigurationNode).IsAssignableFrom(nodeType))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, Resources.ExceptionTypeNotConfigurationNode, nodeType.FullName), "nodeType");
            }

            this.displayName = displayName;
            this.dataType    = dataType;
        }
		/// <summary>
		/// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
		/// </summary>		
		/// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
		/// <param name="text">The text for the command.</param>
		/// <param name="longText">The text that will be in the status bar.</param>
		/// <param name="commandState">One of the <see cref="CommandState"/> values.</param>		
		/// <param name="command">The command to execute.</param>		
		/// <param name="shortcut">A short cut for the command.</param>
		/// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
		/// <param name="icon">The icon for the command.</param>
		public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
			string longText, CommandState commandState,
			ConfigurationNodeCommand command, Shortcut shortcut,
			InsertionPoint insertionPoint, Icon icon) 
			: this(serviceProvider,
			text, longText, commandState, NodeMultiplicity.Allow, command, null,
			shortcut, insertionPoint, icon)
		{			
		}
 /// <summary>
 /// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
 /// </summary>
 /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
 /// <param name="text">The text for the command.</param>
 /// <param name="longText">The text that will be in the status bar.</param>
 /// <param name="commandState">One of the <see cref="CommandState"/> values.</param>
 /// <param name="command">The command to execute.</param>
 /// <param name="shortcut">A short cut for the command.</param>
 /// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
 /// <param name="icon">The icon for the command.</param>
 public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
                               string longText, CommandState commandState,
                               ConfigurationNodeCommand command, Shortcut shortcut,
                               InsertionPoint insertionPoint, Icon icon)
     : this(serviceProvider,
            text, longText, commandState, NodeMultiplicity.Allow, command, null,
            shortcut, insertionPoint, icon)
 {
 }
 /// <summary>
 /// <para>Initializes a new instance of the class with a specified caption, event handler, associated shortcut key, icon, status bar text, and the insertion point for the menu item.</para>
 /// </summary>
 /// <param name="text">
 /// <para>The caption for the menu item.</para>
 /// </param>
 /// <param name="command">
 /// <para>The <see cref="ConfigurationNodeCommand"/> to execute.</para>
 /// </param>
 /// <param name="node">
 /// <para>The <see cref="ConfigurationNode"/> to execute the command upon.</para>
 /// </param>
 /// <param name="shortcut">
 /// <para>One of the <see cref="Shortcut"/> values.</para>
 /// </param>
 /// <param name="statusBarText">
 /// <para>The text for the status bar.</para>
 /// </param>
 /// <param name="insertionPoint">
 /// <para>One of the <see cref="InsertionPoint"/> values.</para>
 /// </param>
 public ConfigurationMenuItem(string text, ConfigurationNodeCommand command, ConfigurationNode node, Shortcut shortcut, string statusBarText, InsertionPoint insertionPoint) : base(text, null, shortcut)
 {
     if (command == null)
     {
         throw new ArgumentNullException("command");
     }
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     this.statusBarText  = statusBarText;
     this.insertionPoint = insertionPoint;
     this.command        = command;
     this.node           = node;
 }
		/// <summary>
		/// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
		/// </summary>		
		/// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
		/// <param name="text">The text for the command.</param>
		/// <param name="longText">The text that will be in the status bar.</param>
		/// <param name="commandState">One of the <see cref="CommandState"/> values.</param>		
		/// <param name="multiplicity">One of the <see cref="NodeMultiplicity"/> values.</param>
		/// <param name="command">The command to execute.</param>		
		/// <param name="nodeType">The node type that will be created when the command is executed.</param>
		/// <param name="shortcut">A short cut for the command.</param>
		/// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
		/// <param name="icon">The icon for the command.</param>
		public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
			string longText, CommandState commandState, NodeMultiplicity multiplicity,
			ConfigurationNodeCommand command, Type nodeType, Shortcut shortcut, 
			InsertionPoint insertionPoint, Icon icon)
		{
			this.text = text;
			this.longText = longText;
			this.commandState = commandState;
			this.command = command;
			this.nodeType = nodeType;
			this.insertionPoint = insertionPoint;
			this.shortcut = shortcut;
			this.icon = icon;
			this.serviceProvider = serviceProvider;
			this.multiplicity = multiplicity;
		}
Example #6
0
 /// <summary>
 /// <para>Initializes a new instance of the class with a specified caption, event handler, associated shortcut key, icon, status bar text, and the insertion point for the menu item.</para>
 /// </summary>
 /// <param name="text">
 /// <para>The caption for the menu item.</para>
 /// </param>
 /// <param name="command">
 /// <para>The <see cref="ConfigurationNodeCommand"/> to execute.</para>
 /// </param>
 /// <param name="node">
 /// <para>The <see cref="ConfigurationNode"/> to execute the command upon.</para>
 /// </param>
 /// <param name="shortcut">
 /// <para>One of the <see cref="Shortcut"/> values.</para>
 /// </param>
 /// <param name="statusBarText">
 /// <para>The text for the status bar.</para>
 /// </param>
 /// <param name="insertionPoint">
 /// <para>One of the <see cref="InsertionPoint"/> values.</para>
 /// </param>
 public ConfigurationMenuItem(string text, ConfigurationNodeCommand command, ConfigurationNode node, Shortcut shortcut, string statusBarText, InsertionPoint insertionPoint)
     : base(text, null, shortcut)
 {
     if (command == null)
     {
         throw new ArgumentNullException("command");
     }
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     this.statusBarText = statusBarText;
     this.insertionPoint = insertionPoint;
     this.command = command;
     this.node = node;
 }
 /// <summary>
 /// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
 /// </summary>
 /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
 /// <param name="text">The text for the command.</param>
 /// <param name="longText">The text that will be in the status bar.</param>
 /// <param name="commandState">One of the <see cref="CommandState"/> values.</param>
 /// <param name="multiplicity">One of the <see cref="NodeMultiplicity"/> values.</param>
 /// <param name="command">The command to execute.</param>
 /// <param name="nodeType">The node type that will be created when the command is executed.</param>
 /// <param name="shortcut">A short cut for the command.</param>
 /// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
 /// <param name="icon">The icon for the command.</param>
 public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
                               string longText, CommandState commandState, NodeMultiplicity multiplicity,
                               ConfigurationNodeCommand command, Type nodeType, Shortcut shortcut,
                               InsertionPoint insertionPoint, Icon icon)
 {
     this.text            = text;
     this.longText        = longText;
     this.commandState    = commandState;
     this.command         = command;
     this.nodeType        = nodeType;
     this.insertionPoint  = insertionPoint;
     this.shortcut        = shortcut;
     this.icon            = icon;
     this.serviceProvider = serviceProvider;
     this.multiplicity    = multiplicity;
 }
Example #8
0
        /// <summary>
        /// <para>Initialize a new instance of the <see cref="NodeCreationEntry"/> with a command, the node type to create, the configuration data type associated with the node, name to display for this node, and if there can be more than one node of the type.</para>
        /// </summary>
        /// <param name="configurationNodeCommand"><para>The <see cref="ConfigurationNodeCommand"/> used to create the node.</para></param>
        /// <param name="nodeType"><para>The <see cref="Type"/> of the node to create.</para></param>
        /// <param name="dataType"><para>The <see cref="Type"/> of the configuration data associated with the <paramref name="nodeType"/>.</para></param>
        /// <param name="displayName"><para>The name to display in the user interface to create the node.</para></param>
        /// <param name="allowMultiple">
        /// <para>Determines if more than one of the node type can exist.</para>
        /// </param>
        private NodeCreationEntry(ConfigurationNodeCommand configurationNodeCommand, Type nodeType, Type dataType, string displayName, bool allowMultiple)
        {
            ArgumentValidation.CheckForNullReference(configurationNodeCommand, "configurationNodeCommand");
            ArgumentValidation.CheckForNullReference(nodeType, "nodeType");
            ArgumentValidation.CheckForNullReference(dataType, "dataType");
            ArgumentValidation.CheckForNullReference(displayName, "displayName");

            this.configurationNodeCommand = configurationNodeCommand;
            this.allowMultiple            = allowMultiple;
            this.nodeType = nodeType;
            if (!typeof(ConfigurationNode).IsAssignableFrom(nodeType))
            {
                throw new ArgumentException(SR.ExceptionTypeNotConfigurationNode(nodeType.FullName), "nodeType");
            }

            this.displayName = displayName;
            this.dataType    = dataType;
        }
Example #9
0
        /// <summary>
        /// <para>Initialize a new instance of the <see cref="NodeCreationEntry"/> with a command, the node type to create, the configuration data type associated with the node, name to display for this node, and if there can be more than one node of the type.</para>
        /// </summary>
        /// <param name="configurationNodeCommand"><para>The <see cref="ConfigurationNodeCommand"/> used to create the node.</para></param>
        /// <param name="nodeType"><para>The <see cref="Type"/> of the node to create.</para></param>
        /// <param name="dataType"><para>The <see cref="Type"/> of the configuration data associated with the <paramref name="nodeType"/>.</para></param>
        /// <param name="displayName"><para>The name to display in the user interface to create the node.</para></param>
        /// <param name="allowMultiple">
        /// <para>Determines if more than one of the node type can exist.</para>
        /// </param>
        private NodeCreationEntry(ConfigurationNodeCommand configurationNodeCommand, Type nodeType, Type dataType, string displayName, bool allowMultiple)
        {
            ArgumentValidation.CheckForNullReference(configurationNodeCommand, "configurationNodeCommand");
            ArgumentValidation.CheckForNullReference(nodeType, "nodeType");
            ArgumentValidation.CheckForNullReference(dataType, "dataType");
            ArgumentValidation.CheckForNullReference(displayName, "displayName");

            this.configurationNodeCommand = configurationNodeCommand;
            this.allowMultiple = allowMultiple;
            this.nodeType = nodeType;
            if (!typeof(ConfigurationNode).IsAssignableFrom(nodeType))
            {
                throw new ArgumentException(SR.ExceptionTypeNotConfigurationNode(nodeType.FullName), "nodeType");
            }

            this.displayName = displayName;
            this.dataType = dataType;
        }
        /// <summary>
        /// Initialize a new instance of the <see cref="NodeCreationEntry"/> with a command, the node type to create, the configuration data type associated with the node, name to display for this node, and if there can be more than one node of the type.
        /// </summary>
        /// <param name="configurationNodeCommand">The <see cref="ConfigurationNodeCommand"/> used to create the node.</param>
        /// <param name="nodeType">The <see cref="Type"/> of the node to create.</param>
        /// <param name="dataType">The <see cref="Type"/> of the configuration data associated with the <paramref name="nodeType"/>.</param>
        /// <param name="displayName">The name to display in the user interface to create the node.</param>
        /// <param name="allowMultiple">
        /// Determines if more than one of the node type can exist.
        /// </param>
        private NodeCreationEntry(ConfigurationNodeCommand configurationNodeCommand, Type nodeType, Type dataType, string displayName, bool allowMultiple)
        {
            if (null == configurationNodeCommand) throw new ArgumentNullException("configurationNodeCommand");
            if (null == nodeType) throw new ArgumentNullException("nodeType");
            if (null == dataType) throw new ArgumentNullException("dataType");
            if (string.IsNullOrEmpty(displayName)) throw new ArgumentException(Resources.ExceptionStringNullOrEmpty, "displayName");

            this.configurationNodeCommand = configurationNodeCommand;
            this.allowMultiple = allowMultiple;
            this.nodeType = nodeType;
            if (!typeof(ConfigurationNode).IsAssignableFrom(nodeType))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, Resources.ExceptionTypeNotConfigurationNode, nodeType.FullName), "nodeType");
            }

            this.displayName = displayName;
            this.dataType = dataType;
        }
Example #11
0
 /// <summary>
 /// <para>Create a new instance of the <see cref="NodeCreationEntry"/> that does not allows multiple nodes in the same parent node with a command, the node type to create, the configuration data type associated with the node and name to display for this node.</para>
 /// </summary>
 /// <param name="configurationNodeCommand"><para>The <see cref="ConfigurationNodeCommand"/> used to create the node.</para></param>
 /// <param name="nodeType"><para>The <see cref="Type"/> of the node to create.</para></param>
 /// <param name="dataType"><para>The <see cref="Type"/> of the configuration data associated with the <paramref name="nodeType"/>.</para></param>
 /// <param name="displayName"><para>The name to display in the user interface to create the node.</para></param>
 public static NodeCreationEntry CreateNodeCreationEntryNoMultiples(ConfigurationNodeCommand configurationNodeCommand, Type nodeType, Type dataType, string displayName)
 {
     return(new NodeCreationEntry(configurationNodeCommand, nodeType, dataType, displayName, false));
 }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="serviceProvider"></param>
		/// <param name="text"></param>
		/// <param name="longText"></param>
		/// <param name="command"></param>
		/// <param name="nodeType"></param>
		/// <returns></returns>
		public static ConfigurationUICommand CreateMultipleUICommand(IServiceProvider serviceProvider, string text, string longText, ConfigurationNodeCommand command, Type nodeType)
		{
			return new ConfigurationUICommand(serviceProvider,
				text,
				longText,
				CommandState.Enabled,
				NodeMultiplicity.Allow,
				command,
				nodeType,
				Shortcut.None,
				InsertionPoint.New,
				null);
		}
Example #13
0
 /// <summary>
 /// <para>Create a new instance of the <see cref="NodeCreationEntry"/> that allows multiple nodes in the same parent node with a command, the node type to create, the configuration data type associated with the node and name to display for this node.</para>
 /// </summary>
 /// <param name="configurationNodeCommand"><para>The <see cref="ConfigurationNodeCommand"/> used to create the node.</para></param>
 /// <param name="nodeType"><para>The <see cref="Type"/> of the node to create.</para></param>
 /// <param name="dataType"><para>The <see cref="Type"/> of the configuration data associated with the <paramref name="nodeType"/>.</para></param>
 /// <param name="displayName"><para>The name to display in the user interface to create the node.</para></param>
 public static NodeCreationEntry CreateNodeCreationEntryWithMultiples(ConfigurationNodeCommand configurationNodeCommand, Type nodeType, Type dataType, string displayName)
 {
     return new NodeCreationEntry(configurationNodeCommand, nodeType, dataType, displayName, true);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="serviceProvider"></param>
 /// <param name="text"></param>
 /// <param name="longText"></param>
 /// <param name="command"></param>
 /// <param name="nodeType"></param>
 /// <returns></returns>
 public static ConfigurationUICommand CreateMultipleUICommand(IServiceProvider serviceProvider, string text, string longText, ConfigurationNodeCommand command, Type nodeType)
 {
     return(new ConfigurationUICommand(serviceProvider,
                                       text,
                                       longText,
                                       CommandState.Enabled,
                                       NodeMultiplicity.Allow,
                                       command,
                                       nodeType,
                                       Shortcut.None,
                                       InsertionPoint.New,
                                       null));
 }