Class TemplateManager
Handle templates for creating Package, ProjectReference
public class TemplateManager
- Inheritance
-
objectTemplateManager
- Extension Methods
Methods
FindTemplateGenerator<TParameters>(TemplateDescription)
Finds a template generator supporting the specified template description
public static ITemplateGenerator<TParameters>? FindTemplateGenerator<TParameters>(TemplateDescription description) where TParameters : TemplateGeneratorParameters
Parameters
descriptionTemplateDescriptionThe description.
Returns
- ITemplateGenerator<TParameters>
A template generator supporting the specified description or null if not found.
Type Parameters
TParameters
FindTemplateGenerator<TParameters>(TParameters)
Finds a template generator supporting the specified template description
public static ITemplateGenerator<TParameters>? FindTemplateGenerator<TParameters>(TParameters parameters) where TParameters : TemplateGeneratorParameters
Parameters
parametersTParametersThe parameters.
Returns
- ITemplateGenerator<TParameters>
A template generator supporting the specified description or null if not found.
Type Parameters
TParameters
FindTemplates(PackageSession?)
Finds all template descriptions.
public static IEnumerable<TemplateDescription> FindTemplates(PackageSession? session = null)
Parameters
sessionPackageSession
Returns
- IEnumerable<TemplateDescription>
A sequence containing all registered template descriptions.
FindTemplates(TemplateScope, PackageSession?)
Finds template descriptions that match the given scope.
public static IEnumerable<TemplateDescription> FindTemplates(TemplateScope scope, PackageSession? session = null)
Parameters
scopeTemplateScopesessionPackageSession
Returns
- IEnumerable<TemplateDescription>
A sequence containing all registered template descriptions that match the given scope.
Register(ITemplateGenerator)
Registers the specified factory.
public static void Register(ITemplateGenerator generator)
Parameters
generatorITemplateGeneratorThe factory.
Exceptions
- ArgumentNullException
factory
RegisterPackage(Package)
Adds a package whose templates FindTemplates(PackageSession?) lists. May be called from any thread (template packages downloaded in the background register when ready). Registering a package already registered, which gained templates since, only signals the change.
public static void RegisterPackage(Package package)
Parameters
packagePackage
Unregister(ITemplateGenerator)
Unregisters the specified factory.
public static void Unregister(ITemplateGenerator generator)
Parameters
generatorITemplateGeneratorThe factory.
Exceptions
- ArgumentNullException
factory
Events
PackagesChanged
Raised after RegisterPackage(Package) added templates, on the calling thread (possibly a background one). Lets an open template list show packages that arrive late.
public static event Action? PackagesChanged