Example #1
0
 /// <summary>
 /// Finds a template generator supporting the specified template description
 /// </summary>
 /// <param name="description">The description.</param>
 /// <returns>A template generator supporting the specified description or null if not found.</returns>
 public static ITemplateGenerator FindTemplateGenerator(TemplateDescription description)
 {
     if (description == null) throw new ArgumentNullException("description");
     lock (ThisLock)
     {
         // From most recently registered to older
         for (int i = Generators.Count - 1; i >=0 ; i--)
         {
             var generator = Generators[i];
             if (generator.IsSupportingTemplate(description))
             {
                 return generator;
             }
         }
     }
     return null;
 }
Example #2
0
 /// <summary>
 /// Finds a template generator supporting the specified template description
 /// </summary>
 /// <param name="description">The description.</param>
 /// <returns>A template generator supporting the specified description or null if not found.</returns>
 public static ITemplateGenerator FindTemplateGenerator(TemplateDescription description)
 {
     if (description == null)
     {
         throw new ArgumentNullException("description");
     }
     lock (ThisLock)
     {
         // From most recently registered to older
         for (int i = Generators.Count - 1; i >= 0; i--)
         {
             var generator = Generators[i];
             if (generator.IsSupportingTemplate(description))
             {
                 return(generator);
             }
         }
     }
     return(null);
 }
Example #3
0
 /// <summary>
 /// Finds a template generator supporting the specified template description
 /// </summary>
 /// <param name="description">The description.</param>
 /// <returns>A template generator supporting the specified description or null if not found.</returns>
 public static ITemplateGenerator <TParameters> FindTemplateGenerator <TParameters>(TemplateDescription description) where TParameters : TemplateGeneratorParameters
 {
     if (description == null)
     {
         throw new ArgumentNullException(nameof(description));
     }
     lock (ThisLock)
     {
         // From most recently registered to older
         for (int i = Generators.Count - 1; i >= 0; i--)
         {
             var generator = Generators[i] as ITemplateGenerator <TParameters>;
             if (generator != null && generator.IsSupportingTemplate(description))
             {
                 return(generator);
             }
         }
     }
     return(null);
 }
Example #4
0
 public abstract bool IsSupportingTemplate(TemplateDescription templateDescription);
 public bool IsSupportingTemplate(TemplateDescription templateDescription)
 {
     return true;
 }
Example #6
0
 public abstract bool IsSupportingTemplate(TemplateDescription templateDescription);
 public override bool IsSupportingTemplate(TemplateDescription templateDescription)
 {
     if (templateDescription == null) throw new ArgumentNullException(nameof(templateDescription));
     return templateDescription.Id == TemplateId;
 }