MatrixDataProviderExtension Class |
Namespace: CTExtensions.Interfaces
The MatrixDataProviderExtension type exposes the following members.
Name | Description | |
---|---|---|
MatrixDataProviderExtension | Initializes a new instance of the MatrixDataProviderExtension class |
Name | Description | |
---|---|---|
GetParent |
Must implement. Return parent CTExtension of this extension interface.
| |
OverrideMatrixData |
Allows overriding matrix data (Revisions, CustomScopes) for files when the CT Core
is about to read and cache it. Enables custom data sourcing for Revisions and CustomScopes.
|
// @AUTO-REFERENCE { [CT_INSTALL_PATH]\CTInterface.dll } // @AUTO-REFERENCE { [CT_INSTALL_PATH]\Interop.CTEngineLib.dll } using ATR.CT.CTInterface; using CTExtensions; using CTExtensions.Interfaces; using CTEngineLib; using System.Collections.Generic; using System; namespace Example { /* * YOU MUST HAVE only following Revision scope properties defined * (Attribute | Label) and they must be editboxes: * * revision | Revision * description | Description * designer | Approved By * * * This extension overrides revisions with following data * * A | Here's Johnny! | Jack Nicholson * B | Say 'hello' to my little friend! | Al Pacino * C | Revision you can't refuse. | Marlon Brando * */ public class RevisionsExtension : CTExtension { private RevisionProvider moRevisionProvider = null; public override bool Hook(CTInterface oCTInterface) { return false; } public override void UnHook(CTInterface oCTInterface) { } public override IExtensionInterface[] GetInterface2(ctExtensionInterface eInterface) { if (eInterface == ctExtensionInterface.ctExtensionInterfaceMatrixDataProvider) { if (moRevisionProvider == null) moRevisionProvider = new RevisionProvider(this); return new[] { moRevisionProvider }; } return null; } class RevisionProvider : MatrixDataProviderExtension { RevisionsExtension moParent; public RevisionProvider(RevisionsExtension parent) { moParent = parent; } public override ICTExtension GetParent() { return moParent; } public override bool OverrideMatrixData(string bsFilename, string bsConfiguration, ctPropertyScope eScope, string bsData, ref string pbsOverriddenData) { bool bOverride = false; if (eScope == ctPropertyScope.ctPropertyScopeRevision) { var headers = new Dictionary<string, string>(StringComparer.CurrentCultureIgnoreCase) { { "revision", "Revision" }, { "description", "Description" }, { "designer", "Approved By" } }; var data = new MatrixData(headers); var row = data.AddRow(); row.SetValue("revision", "A"); row.SetValue("description", "Here's Johnny!"); row.SetValue("designer", "Jack Nicholson"); row = data.AddRow(); row.SetValue("revision", "B"); row.SetValue("description", "Say 'hello' to my little friend!"); row.SetValue("designer", "Al Pacino"); row = data.AddRow(); row.SetValue("revision", "C"); row.SetValue("description", "Revision you can't refuse."); row.SetValue("designer", "Marlon Brando"); pbsOverriddenData = data.ToString(); bOverride = true; } return bOverride; } } } }
CUSTOMTOOLS 2022 SP1