@code { private string _mxcUri; private string _style; private string _resolvedUri; [Parameter] public string MxcUri { get => _mxcUri ?? ""; set { Console.WriteLine($"New MXC uri: {value}"); _mxcUri = value; UriHasChanged(value); } } [Parameter] public bool Circular { get; set; } [Parameter] public int? Width { get; set; } [Parameter] public int? Height { get; set; } [Parameter] public string Style { get => _style; set { _style = value; StateHasChanged(); } } [CascadingParameter, Parameter] public RemoteHomeserver? Homeserver { get; set; } private string ResolvedUri { get => _resolvedUri; set { _resolvedUri = value; StateHasChanged(); } } private string StyleString => $"{Style} {(Circular ? "border-radius: 50%;" : "")} {(Width.HasValue ? $"width: {Width}px;" : "")} {(Height.HasValue ? $"height: {Height}px;" : "")} object-fit: cover;"; private static readonly string Prefix = "mxc://"; private static readonly int PrefixLength = Prefix.Length; private async Task UriHasChanged(string value) { // if (!value.StartsWith(Prefix)) { // Console.WriteLine($"UriHasChanged: {value} does not start with {Prefix}, passing as resolved URI!!!"); // ResolvedUri = value; // return; // } // var uri = value[PrefixLength..].Split('/'); // Console.WriteLine($"UriHasChanged: {value} {uri[0]}"); // if (Homeserver is null) { // Console.WriteLine($"Homeserver is null, creating new remotehomeserver for {uri[0]}"); // Homeserver = await hsProvider.GetRemoteHomeserver(uri[0]); // } // ResolvedUri = Homeserver.ResolveMediaUri(value); // Console.WriteLine($"ResolvedUri: {ResolvedUri}"); } // [Parameter] // public string Class { get; set; } }