@using System.Text.Json
@using System.Text.Json.Serialization
@using ErsatzTV.Application.MediaItems
@inject IJSRuntime JsRuntime
@code {
[CascadingParameter]
IMudDialogInstance MudDialog { get; set; }
[Parameter]
public MediaItemInfo MediaItemInfo { get; set; }
private string _info;
private ElementReference _infoView;
protected override Task OnParametersSetAsync()
{
try
{
_info = JsonSerializer.Serialize(
MediaItemInfo,
new JsonSerializerOptions
{
Converters = { new JsonStringEnumConverter() },
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
WriteIndented = true
});
}
catch (Exception ex)
{
_info = ex.ToString();
}
return Task.CompletedTask;
}
private async Task CopyToClipboard(ElementReference view) => await JsRuntime.InvokeVoidAsync("clipboardCopy.copyText", view);
private void Close() => MudDialog.Close(DialogResult.Ok(true));
}