Bozza modifica lettura file x invio test BTL
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -14,7 +17,7 @@ namespace WebAedificaConfigurator
|
||||
string m_sSvg = "";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<Dictionary<string,string>> EC_OnSave { get; set; }
|
||||
public EventCallback<Dictionary<string, string>> EC_OnSave { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string CssSvg { get; set; } = "responsive-svg";
|
||||
@@ -32,12 +35,37 @@ namespace WebAedificaConfigurator
|
||||
/// <returns></returns>
|
||||
protected async Task DoSave()
|
||||
{
|
||||
Dictionary<string,string> Args = new Dictionary<string,string>();
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("FilePath", m_FilePath);
|
||||
Args.Add("Mode", 1.ToString());
|
||||
await EC_OnSave.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue lettura file + invio richiesta specifica
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
private async Task UploadFile(InputFileChangeEventArgs e)
|
||||
{
|
||||
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
|
||||
// leggo il contenuto del PRIMO (singolo) file
|
||||
IBrowserFile file = e.File;
|
||||
// limite file size (e.g., 5 MB)
|
||||
var maxAllowedSize = 1024 * 1024;
|
||||
|
||||
using var stream = file.OpenReadStream(maxAllowedSize);
|
||||
using var reader = new StreamReader(stream);
|
||||
string rawContent = await reader.ReadToEndAsync();
|
||||
Args.Add("Btl", rawContent);
|
||||
// da sostituire con Enums.EngineQueryType.Preview
|
||||
Args.Add("Mode", "1");
|
||||
await EC_OnSave.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Componente SVG da mostrare
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user