Ejemplo n.º 1
0
        /// <summary>
        /// Attempt to find a registered part and then asks it to create a service action with the given initial serviceName parameter value.
        /// If the desired part cannot be found then the method returns null (if throwOnNotFound is false) or it throws a PartIDNotFoundException (if the throwOnNotFound is true).
        /// </summary>
        /// <param name="partID">Gives the part ID on which to create a service action.</param>
        /// <param name="serviceName">Gives the initial value of the service name to be performed, or null, or string.Empty if the name is not already known.</param>
        /// <param name="namedParamValues">Gives the initial value that the created action's NamedParamValues will be set to.</param>
        /// <param name="throwOnNotFound">When true this method will throw a PartIDNotFoundException if the given partID is not found.  When false the method will return null when the given partID is not found.</param>
        /// <exception cref="PartIDNotFoundException">Thrown when the partID is not found and throwOnNotFound is given as true.</exception>
        public IStringParamAction CreateServiceAction(string partID, string serviceName, INamedValueSet namedParamValues, bool throwOnNotFound)
        {
            IActivePartBase part = FindPart(partID, throwOnNotFound);

            if (part == null)
            {
                return(null);
            }

            IStringParamAction action = part.CreateServiceAction(serviceName);

            action.NamedParamValues = namedParamValues;

            return(action);
        }