WebWindowComplex:
- Aggiunto Nuget Web.Window.Data - Aggiornate classi Window e JsonUtility - Aggiornata interfaccia
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Runtime.InteropServices;
|
||||
using WebWindow.Base;
|
||||
using Egw.Window.Data;
|
||||
using WebWindowComplex.DTO;
|
||||
using WebWindowComplex.Json;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
@@ -295,6 +297,62 @@ namespace WebWindowComplex
|
||||
Sash.s_SelFamilyHW = IN_SelFamilyHardware;
|
||||
}
|
||||
|
||||
// Ancora da fare...
|
||||
protected async Task DoClose()
|
||||
{
|
||||
await EC_OnClose.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Anteprima SVG
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoPreviewSvg()
|
||||
{
|
||||
if (m_CurrWindow != null)
|
||||
{
|
||||
var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented);
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}");
|
||||
Args.Add("Jwd", CurrJwd);
|
||||
await EC_OnUpdate.InvokeAsync(Args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di reset dei dati a quelli del template
|
||||
/// </summary>
|
||||
protected async Task DoReset()
|
||||
{
|
||||
// Aggiornati parametri di ingresso selezionati
|
||||
Area.nCounterGroup = 0;
|
||||
UpdateSelParameter();
|
||||
JsonWindow WindowFromJson;
|
||||
if (string.IsNullOrEmpty(CurrJwd))
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
else
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_CurrJwd!, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
if (m_CurrWindow != null)
|
||||
{
|
||||
m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview;
|
||||
m_CurrWindow = null;
|
||||
}
|
||||
m_CurrWindow = WindowFromJson.Deserialize();
|
||||
m_CurrWindow.OnPreview += M_CurrWindow_OnPreview;
|
||||
// Aggiorante liste sash, split, splitted, fill e itemTable
|
||||
UpdateLists();
|
||||
currSash = -1;
|
||||
currStep = CompileStep.Gerarchia;
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
// Ancora da fare..
|
||||
protected async Task DoSave()
|
||||
{
|
||||
//manca salvataggio JWD
|
||||
await EC_OnClose.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per la scelta della maniglia univoca
|
||||
/// </summary>
|
||||
@@ -316,6 +374,20 @@ namespace WebWindowComplex
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.bHasHandle)
|
||||
{
|
||||
switch (item.SelOpeningType)
|
||||
{
|
||||
case Openings.TILTTURN_LEFT:
|
||||
item.SetOpeningType(Openings.TURNONLY_LEFT);
|
||||
break;
|
||||
case Openings.TILTTURN_RIGHT:
|
||||
item.SetOpeningType(Openings.TURNONLY_RIGHT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
item.bHasHandle = false;
|
||||
}
|
||||
}
|
||||
@@ -323,58 +395,55 @@ namespace WebWindowComplex
|
||||
}
|
||||
}
|
||||
|
||||
// Ancora da fare...
|
||||
protected async Task DoClose()
|
||||
{
|
||||
await EC_OnClose.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Anteprima SVG
|
||||
/// Metodo per la scelta dello split intero nella modalità griglia
|
||||
/// </summary>
|
||||
/// <param name="currSplit"> split su cui si sceglie </param>
|
||||
/// <returns></returns>
|
||||
protected async Task DoPreviewSvg()
|
||||
protected void changeStartVert(ChangeEventArgs e, Split currSplit)
|
||||
{
|
||||
if (m_CurrWindow != null)
|
||||
// Cerco la Sash che si sta considerando nella lista Sash
|
||||
foreach (Split s in SplitList)
|
||||
{
|
||||
var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented);
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("Mode", $"{(int)Enums.EngineQueryType.Preview}");
|
||||
Args.Add("Jwd", CurrJwd);
|
||||
await EC_OnUpdate.InvokeAsync(Args);
|
||||
if (s.Equals(currSplit))
|
||||
{
|
||||
s.SetSplitStartVert((bool)e.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di reset dei dati a quelli del template
|
||||
/// Metodo per determinare la descrizione del parent dello split corrente
|
||||
/// </summary>
|
||||
protected async Task DoReset()
|
||||
/// <param name="currSplit"> split corrente </param>
|
||||
/// <returns></returns>
|
||||
protected string descParentSplit(Split currSplit)
|
||||
{
|
||||
// Aggiornati parametri di ingresso selezionati
|
||||
UpdateSelParameter();
|
||||
JsonWindow WindowFromJson;
|
||||
if (string.IsNullOrEmpty(CurrJwd))
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
else
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_CurrJwd!, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
if (m_CurrWindow != null)
|
||||
if ((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0)
|
||||
{
|
||||
m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview;
|
||||
m_CurrWindow = null;
|
||||
for (int j = 0; j < SashList.Count; j++)
|
||||
{
|
||||
if (SashList[j].Equals(currSplit.ParentArea))
|
||||
{
|
||||
return "Sash " + (j + 1);
|
||||
}
|
||||
else if (SashList[j].Equals(currSplit.ParentArea.ParentArea))
|
||||
{
|
||||
for (int k = 0; k < SashList[j].AreaList.Count; k++)
|
||||
{
|
||||
if (SashList[j].AreaList[k].AreaList[0].Equals(currSplit))
|
||||
{
|
||||
return "Sash " + (j + 1) + " - anta " + (k + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_CurrWindow = WindowFromJson.Deserialize();
|
||||
m_CurrWindow.OnPreview += M_CurrWindow_OnPreview;
|
||||
// Aggiorante liste sash, split, splitted, fill e itemTable
|
||||
UpdateLists();
|
||||
currSash = -1;
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
// Ancora da fare..
|
||||
protected async Task DoSave()
|
||||
{
|
||||
//manca salvataggio JWD
|
||||
await EC_OnClose.InvokeAsync(true);
|
||||
else
|
||||
{
|
||||
return "Frame";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -387,20 +456,6 @@ namespace WebWindowComplex
|
||||
await EC_OnSelectedTemplate.InvokeAsync(newSel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per cambiare step e aggiornare preview svg
|
||||
/// </summary>
|
||||
/// <param name="newStep"> step successivo </param>
|
||||
protected async void NextStepAndPreview(CompileStep newStep, int Index = -1)
|
||||
{
|
||||
currStep = newStep;
|
||||
if (newStep == CompileStep.Sash)
|
||||
currSash = Index;
|
||||
else
|
||||
currSash = -1;
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per riempire le liste Sash, Split, Splitted e Fill
|
||||
/// </summary>
|
||||
@@ -719,8 +774,9 @@ namespace WebWindowComplex
|
||||
/// <returns></returns>
|
||||
private async Task CopySash(Splitted currSplitted, int numSash)
|
||||
{
|
||||
//Rimuovo contenuto di Splitted
|
||||
//Rimuovo contenuto di Splitted e rimuovo area da conteggio gruppi
|
||||
currSplitted.AreaList.RemoveAll(i => i != null);
|
||||
//Area.DelCounterGroup();
|
||||
// Copio sash
|
||||
Area a = SashList[numSash].Copy(currSplitted);
|
||||
a.SetParentArea(currSplitted);
|
||||
@@ -729,17 +785,6 @@ namespace WebWindowComplex
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per scambiare due aree di uno split
|
||||
/// </summary>
|
||||
/// <param name="currArea"> Area corrente </param>
|
||||
/// <returns></returns>
|
||||
private async Task SwapTwoAree(Area currArea)
|
||||
{
|
||||
currArea.SwapAree();
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -768,6 +813,47 @@ namespace WebWindowComplex
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per scambiare due aree di uno split
|
||||
/// </summary>
|
||||
/// <param name="currArea"> Area corrente </param>
|
||||
/// <returns></returns>
|
||||
private async Task SwapTwoAree(Area currArea)
|
||||
{
|
||||
currArea.SwapAree();
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per eliminare Split o Sash
|
||||
/// </summary>
|
||||
/// <param name="currArea"> Area corrente </param>
|
||||
/// <returns></returns>
|
||||
private void RemoveArea(Area currArea)
|
||||
{
|
||||
if (currArea is Split)
|
||||
((Split)currArea).Remove();
|
||||
else if (currArea is Sash)
|
||||
{
|
||||
((Sash)currArea).Remove();
|
||||
}
|
||||
currStep = CompileStep.Gerarchia;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per cambiare step e aggiornare preview svg
|
||||
/// </summary>
|
||||
/// <param name="newStep"> step successivo </param>
|
||||
private async void NextStepAndPreview(CompileStep newStep, int Index = -1)
|
||||
{
|
||||
currStep = newStep;
|
||||
if (newStep == CompileStep.Sash)
|
||||
currSash = Index;
|
||||
else
|
||||
currSash = -1;
|
||||
await DoPreviewSvg();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per andare allo step successivo
|
||||
/// </summary>
|
||||
@@ -781,7 +867,7 @@ namespace WebWindowComplex
|
||||
private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e)
|
||||
{
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("Mode", $"{(int)Enums.EngineQueryType.Preview}");
|
||||
Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}");
|
||||
Args.Add("Jwd", e.sJwd);
|
||||
EC_OnUpdate.InvokeAsync(Args);
|
||||
}
|
||||
@@ -812,13 +898,31 @@ namespace WebWindowComplex
|
||||
return (currStep == CompileStep.Template) ? "col-12" : "col-6";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola larghezza border descrizione split
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string splitCss(Split currSplit)
|
||||
{
|
||||
return (currSplit.SelSplitShape == SplitShapes.GRID) ? "col-sm-12" : "col-sm-6";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola larghezza border descrizione split
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string splitContentCss(Split currSplit)
|
||||
{
|
||||
return (currSplit.SelSplitShape == SplitShapes.GRID) ? "col-sm-6" : "col-sm-12";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola larghezza colonna header nav
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string headerCss()
|
||||
{
|
||||
return (currStep == CompileStep.Template) ? "col-10 d-grid gap-1 px-2 d-md-flex justify-content-md-start" : "col-8 d-grid gap-1 px-2 d-md-flex justify-content-md-start";
|
||||
return (currStep == CompileStep.Template) ? "col-8 d-grid gap-1 px-2 d-md-flex justify-content-md-start" : "col-8 d-grid gap-1 px-2 d-md-flex justify-content-md-start";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -827,7 +931,7 @@ namespace WebWindowComplex
|
||||
/// <returns></returns>
|
||||
private string buttonCss()
|
||||
{
|
||||
return (currStep == CompileStep.Template) ? "col-2 d-grid gap-1 d-md-flex justify-content-md-end" : "col-4 d-grid gap-1 d-md-flex justify-content-md-end";
|
||||
return (currStep == CompileStep.Template) ? "col-4 d-grid gap-1 d-md-flex justify-content-md-end" : "col-4 d-grid gap-1 d-md-flex justify-content-md-end";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
Reference in New Issue
Block a user