2using System.Collections.Generic;
3using System.Threading.Tasks;
25 : base(Document, Parent)
40 set => this.url = value;
49 set => this.alt = value;
56 public override Task
FromXml(XmlElement Input)
60 return base.FromXml(Input);
69 base.ExportAttributes(Output);
83 return new ImageUrl(Document, Parent);
92 base.CopyContents(Destination);
110 if (URL.
Ok && !
string.IsNullOrEmpty(URL.
Result))
111 this.StartLoad(URL.
Result);
116 private async
void StartLoad(
string URL)
121 new KeyValuePair<string, string>(
"Accept",
"image/*"));
123 if (Result is SKImage
Image)
144 this.alternative = Element;
146 await base.DoMeasureDimensions(State);
148 if (!(this.alternative is
null))
159 return this.alternative;
170 if (this.
image is
null && !(this.alternative is
null))
173 await base.Draw(State);
182 base.ExportStateAttributes(Output);
Static class managing encoding and decoding of internet content.
static Task< object > GetAsync(Uri Uri, params KeyValuePair< string, string >[] Headers)
Gets a resource, given its URI.
Contains a 2D layout document.
void RaiseUpdated(ILayoutElement Element)
Raises the OnUpdated event.
void Export(XmlWriter Output)
Exports the attribute.
void ExportState(XmlWriter Output)
Exports the state of the attribute.
static async Task< EvaluationResult< T > > TryEvaluate(Attribute< T > Attribute, Variables Session)
Tries to evaluate the attribute value.
Result of asynchronous evaluation.
T Result
Evaluated result, if successful.
bool Ok
If evaluation was successful.
StringAttribute CopyIfNotPreset(Layout2DDocument ForDocument)
Copies the attribute object if undefined, or defined by an expression. Returns a reference to itself,...
Variables Session
Current session.
Abstract base class for images.
SKImage image
Loaded image
An image defined by a URL.
StringAttribute UrlAttribute
URL
override async Task Draw(DrawingState State)
Draws layout entities.
ImageUrl(Layout2DDocument Document, ILayoutElement Parent)
An image defined by a URL.
override void ExportStateAttributes(XmlWriter Output)
Exports the local attributes of the current element.
override string LocalName
Local name of type of element.
override ILayoutElement Create(Layout2DDocument Document, ILayoutElement Parent)
Creates a new instance of the layout element.
override async Task< SKImage > LoadImage(DrawingState State)
Loads the image defined by the element.
override ILayoutElement GetAlternative(DrawingState State)
Gets an alternative representation, in case the image is not available.
override Task FromXml(XmlElement Input)
Populates the element (including children) with information from its XML definition.
StringAttribute AlternativeAttribute
Alternative
override void CopyContents(ILayoutElement Destination)
Copies contents (attributes and children) to the destination element.
override async Task DoMeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions.
override void ExportAttributes(XmlWriter Output)
Exports attributes to XML.
Layout2DDocument Document
Layout document.
Base interface for all layout elements.
Task MeasureDimensions(DrawingState State)
Measures layout entities and defines unassigned properties, related to dimensions....
Layout2DDocument Document
Layout document.
Task DrawShape(DrawingState State)
Draw the shape represented by the layout element.