Class MarkupImporter
- Namespace
- Icy.Markup
- Assembly
- IcyUI.dll
Loads markup documents through the asset pipeline, so a UI file is requested by name like any other asset.
public class MarkupImporter : IAssetImporter<UIElement>, IFormatReadChecker
- Inheritance
-
MarkupImporter
- Implements
- Inherited Members
- Extension Methods
Remarks
Register it with
AddMarkupSupport(IConfigurationBuilder), after which
assets.Load<UIElement>("UI/MainMenu.xml") returns a built tree.
Each import produces a fresh tree - two loads of the same file give two independent element graphs, which is what a UI asset has to do, since elements are stateful and belong to exactly one place in one tree. Whether the underlying file is re-read is the asset scope's business, not this importer's.
Constructors
MarkupImporter(IcyConfiguration)
Loads markup documents through the asset pipeline, so a UI file is requested by name like any other asset.
public MarkupImporter(IcyConfiguration configuration)
Parameters
configurationIcyConfigurationThe configuration whose markup, conversion, and property services are used.
Remarks
Register it with
AddMarkupSupport(IConfigurationBuilder), after which
assets.Load<UIElement>("UI/MainMenu.xml") returns a built tree.
Each import produces a fresh tree - two loads of the same file give two independent element graphs, which is what a UI asset has to do, since elements are stateful and belong to exactly one place in one tree. Whether the underlying file is re-read is the asset scope's business, not this importer's.
Fields
MarkupMimeType
The MIME type markup documents are served as.
public const string MarkupMimeType = "application/xml"
Field Value
TextMarkupMimeType
The alternative MIME type XML files are commonly reported as.
public const string TextMarkupMimeType = "text/xml"
Field Value
Methods
CanRead(string?)
Checks if the importer can read assets in the specified data format.
public bool CanRead(string? format)
Parameters
formatstringA string with
MIME-type for the format of the loaded asset.
Returns
Import(Stream, IImportContext)
Performs asset loading from the specified data stream.
public UIElement Import(Stream stream, IImportContext importContext)
Parameters
streamStreamData stream to read asset from.
importContextIImportContextContext to import the asset.
Returns
Exceptions
- MarkupException
The document is malformed, or breaks a rule of the language.