/// <summary> /// Returns the <see cref="Design" /> implementation of the current open design. /// </summary> /// <typeparam name="TDesign">The type of the design.</typeparam> /// <param name="source">The process framework application.</param> /// <param name="action">The function that will initialize the design (should be used for custom implementations).</param> /// <returns> /// Returns a <see cref="Design" /> representing the design; otherwise <c>null</c>. /// </returns> /// <exception cref="ArgumentNullException">action</exception> public static TDesign GetDesign <TDesign>(this IMMPxApplication source, Func <int, IMMPxApplication, TDesign> action) where TDesign : Design { if (source == null) { return(null); } if (action == null) { throw new ArgumentNullException("action"); } var wm = source.GetWorkflowManager() as IMMWorkflowManager3; if (wm == null) { return(null); } if (wm.CurrentOpenDesign == null) { return(null); } return(action(wm.CurrentOpenDesign.ID, source)); }
/// <summary> /// Returns the <see cref="Design" /> implementation of the current open design. /// </summary> /// <param name="source">The process framework application reference.</param> /// <returns> /// Returns a <see cref="Design" /> representing the design; otherwise <c>null</c>. /// </returns> public static Design GetDesign(this IMMPxApplication source) { if (source == null) { return(null); } var wm = source.GetWorkflowManager() as IMMWorkflowManager3; if (wm == null) { return(null); } if (wm.CurrentOpenDesign == null) { return(null); } return(new Design(source, wm.CurrentOpenDesign)); }