Esempio n. 1
0
        /// <summary>
        ///     Returns the <see cref="WorkRequest" /> implementation of the current open work request.
        /// </summary>
        /// <typeparam name="TWorkRequest">The type of the work request.</typeparam>
        /// <param name="source">The process framework application.</param>
        /// <param name="action">The function that will initialize the work request (should be used for custom implementations).</param>
        /// <returns>
        ///     Returns a <see cref="WorkRequest" /> representing the work request; otherwise <c>null</c>.
        /// </returns>
        /// <exception cref="ArgumentNullException">action</exception>
        public static TWorkRequest GetWorkRequest <TWorkRequest>(this IMMPxApplication source, Func <int, IMMPxApplication, TWorkRequest> action)
            where TWorkRequest : WorkRequest
        {
            if (source == null)
            {
                return(null);
            }
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }

            Design design = source.GetDesign();

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

            return(action(design.WorkRequestID, source));
        }
Esempio n. 2
0
        /// <summary>
        ///     Gets the node with the specified <paramref name="nodeID" />.
        /// </summary>
        /// <param name="nodeID">The node ID.</param>
        /// <returns>
        ///     Returns the <see cref="Miner.Interop.Process.IMMPxNode" /> representing the node.
        /// </returns>
        protected override IMMPxNode GetNode(int nodeID)
        {
            var o = new Design(base.PxApplication, nodeID);

            return(o.Valid ? o.Node : null);
        }