using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Egw.Window.Data; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; namespace WebAedificaConfigurator { public partial class WebAedificaMaker { string m_FilePath = ""; string m_sSvg = ""; [Parameter] public EventCallback> EC_OnSave { get; set; } [Parameter] public string CssSvg { get; set; } = "responsive-svg"; [Parameter] public string LiveSVG { get => m_sSvg; set => m_sSvg = value; } /// /// Salvattagio dizionario contenente il file /// /// protected async Task DoSave() { Dictionary Args = new Dictionary(); Args.Add("FilePath", m_FilePath); Args.Add("Mode", 1.ToString()); await EC_OnSave.InvokeAsync(Args); } /// /// Esegue lettura file + invio richiesta specifica /// /// /// private async Task UploadFile(InputFileChangeEventArgs e) { Dictionary Args = new Dictionary(); // leggo il contenuto del PRIMO (singolo) file IBrowserFile file = e.File; // limite file size (al momento 10 MB) var maxAllowedSize = 10* 1024 * 1024; using var stream = file.OpenReadStream(maxAllowedSize); using var reader = new StreamReader(stream); string rawContent = await reader.ReadToEndAsync(); // parametri richiesta Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}"); Args.Add("Btl", rawContent); await EC_OnSave.InvokeAsync(Args); } /// /// Componente SVG da mostrare /// protected MarkupString outSvg { get { // aggiunta gestione classe svg per posizionamento con costraints var newSvg = LiveSVG.Replace("