예제 #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;
 }
예제 #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);
 }
예제 #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);
 }
예제 #4
0
 public abstract bool IsSupportingTemplate(TemplateDescription templateDescription);
예제 #5
0
 public bool IsSupportingTemplate(TemplateDescription templateDescription)
 {
     return true;
 }
예제 #6
0
 public abstract bool IsSupportingTemplate(TemplateDescription templateDescription);
예제 #7
0
 public override bool IsSupportingTemplate(TemplateDescription templateDescription)
 {
     if (templateDescription == null) throw new ArgumentNullException(nameof(templateDescription));
     return templateDescription.Id == TemplateId;
 }