4using System.Threading.Tasks;
28 : base(Document, Parent)
43 set => this.url = value;
52 set => this.alt = value;
59 public override Task
FromXml(XmlElement Input)
64 return base.FromXml(Input);
73 base.ExportAttributes(Output);
87 return new ImageUrl(Document, Parent);
96 base.CopyContents(Destination);
114 if (URL.
Ok && !
string.IsNullOrEmpty(URL.
Result))
116 if (imageCache.TryGetValue(URL.
Result, out SKImage
Image))
125 new KeyValuePair<string, string>(
"Accept",
"image/*"));
129 imageCache[URL.
Result] = Image2;
136 this.StartLoad(URL.
Result);
142 private async
void StartLoad(
string URL)
147 new KeyValuePair<string, string>(
"Accept",
"image/*"));
151 imageCache[URL] =
Image;
172 this.alternative = Element;
174 await base.DoMeasureDimensions(State);
176 if (!(this.alternative is
null))
187 return this.alternative;
198 if (this.
image is
null && !(this.alternative is
null))
201 await base.Draw(State);
210 base.ExportStateAttributes(Output);
Contains information about a response to a content request.
bool HasError
If an error occurred.
object Decoded
Decoded object.
Static class managing encoding and decoding of internet content.
static Task< ContentResponse > 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.
bool SupportsAsynchronnousUpdates
If asynchronous updates are supported.
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.
Implements an in-memory cache.
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.