Update catena eventi x richiesta reset dizionario
This commit is contained in:
@@ -31,6 +31,12 @@ namespace WebWindowComplex.Compo
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqClose { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per richiedere reset dizionario Shape
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiornare info frame (es cambaire tutti i Joints)
|
||||
/// </summary>
|
||||
@@ -63,6 +69,27 @@ namespace WebWindowComplex.Compo
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int SelShapeIndex
|
||||
{
|
||||
get => FrameWindow.SelShapeIndex;
|
||||
set
|
||||
{
|
||||
if (FrameWindow.SelShapeIndex != value)
|
||||
{
|
||||
// richiesta reset dict shape
|
||||
_ = EC_ReqResetDictShape.InvokeAsync(true);
|
||||
//foreach(var s in SashList)
|
||||
// s.SelHardwareFromId = "000000";
|
||||
FrameWindow.SelShapeIndex = value;
|
||||
_ = EC_UpdateShape.InvokeAsync(FrameWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -123,21 +150,6 @@ namespace WebWindowComplex.Compo
|
||||
}
|
||||
}
|
||||
|
||||
protected int SelShapeIndex
|
||||
{
|
||||
get => FrameWindow.SelShapeIndex;
|
||||
set
|
||||
{
|
||||
if (FrameWindow.SelShapeIndex != value)
|
||||
{
|
||||
//foreach(var s in SashList)
|
||||
// s.SelHardwareFromId = "000000";
|
||||
FrameWindow.SelShapeIndex = value;
|
||||
_ = EC_UpdateShape.InvokeAsync(FrameWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento joint
|
||||
/// </summary>
|
||||
|
||||
@@ -60,6 +60,25 @@ namespace WebWindowComplex.DTO
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di equality limitato al controllo del JWD
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public bool JwdEqual(object obj)
|
||||
{
|
||||
if ((obj == null))
|
||||
return false;
|
||||
|
||||
if (!(obj is LivePayload item))
|
||||
return false;
|
||||
|
||||
if (CurrJwd != item.CurrJwd)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override hash method
|
||||
/// </summary>
|
||||
|
||||
@@ -134,6 +134,7 @@
|
||||
EC_AddSash="() => AddSashToFrame(FrameWindow!)"
|
||||
EC_AddSplit="() => AddSplitToFrame(FrameWindow!)"
|
||||
EC_ReqClose="ReturnTree"
|
||||
EC_ReqResetDictShape="ReqResetDict"
|
||||
EC_UpdateShape="UpdateShape"
|
||||
EC_UpdateFrame="UpdateFrame">
|
||||
</CardFrame>
|
||||
|
||||
@@ -13,6 +13,23 @@ namespace WebWindowComplex
|
||||
{
|
||||
public partial class TableComp : IDisposable
|
||||
{
|
||||
#region Public Enums
|
||||
|
||||
public enum DataAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Nessuna richiesta
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Reset dizionario shape
|
||||
/// </summary>
|
||||
ResetDictShape
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -27,6 +44,12 @@ namespace WebWindowComplex
|
||||
[Parameter]
|
||||
public SelectPayload? CurrSelection { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta azione al parent
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataAction> EC_ActionReq { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta update da JWD (SVG, calcoli vari...)
|
||||
/// </summary>
|
||||
@@ -592,8 +615,6 @@ namespace WebWindowComplex
|
||||
listWarnings = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
private bool firstDisplay = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gestione update post ricezione parametri da controllo chiamante
|
||||
/// </summary>
|
||||
@@ -611,8 +632,9 @@ namespace WebWindowComplex
|
||||
if (ListPayload.IsValid())
|
||||
{
|
||||
// SOLO SE modificato live data...
|
||||
if (prevLiveData == null || !prevLiveData.Equals(LiveData))
|
||||
if (prevLiveData == null || !prevLiveData.Equals(LiveData))
|
||||
{
|
||||
bool needDeser = prevLiveData == null || !prevLiveData.JwdEqual(LiveData);
|
||||
updRequested = true;
|
||||
prevLiveData = new LivePayload()
|
||||
{
|
||||
@@ -624,22 +646,29 @@ namespace WebWindowComplex
|
||||
|
||||
// Aggiornati parametri di ingresso selezionati
|
||||
UpdateSelParameter();
|
||||
JsonWindow WindowFromJson = new JsonWindow("", "", "", "");
|
||||
// provo a deserializzare
|
||||
try
|
||||
// provo a deserializzare SE necessario
|
||||
if (needDeser || true)
|
||||
{
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
setCurrWindow(WindowFromJson);
|
||||
//SOLO SE non sono in edit...
|
||||
if (!editLock)
|
||||
JsonWindow WindowFromJson = new JsonWindow("", "", "", "");
|
||||
try
|
||||
{
|
||||
currStep = CompileStep.Tree;
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
setCurrWindow(WindowFromJson);
|
||||
//SOLO SE non sono in edit...
|
||||
if (!editLock)
|
||||
{
|
||||
currStep = CompileStep.Tree;
|
||||
}
|
||||
}
|
||||
// altrimenti errore!
|
||||
catch (Exception ex)
|
||||
{
|
||||
listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}");
|
||||
}
|
||||
}
|
||||
// altrimenti errore!
|
||||
catch (Exception ex)
|
||||
else
|
||||
{
|
||||
listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}");
|
||||
// usando m_currWindow (preesistente) impostare i parametri...
|
||||
}
|
||||
}
|
||||
checkWarnings();
|
||||
@@ -649,7 +678,6 @@ namespace WebWindowComplex
|
||||
}
|
||||
if (updRequested)
|
||||
{
|
||||
|
||||
// se mancasse dizionario forme chiamo quello
|
||||
if (LiveData.DictShape.Count == 0)
|
||||
{
|
||||
@@ -665,21 +693,6 @@ namespace WebWindowComplex
|
||||
await DoReqShape(reqList);
|
||||
}
|
||||
}
|
||||
//// se mancasse xml opzioni hardware lo chiedo
|
||||
//else if (LiveData.DictOptionsXml.Count == 0)
|
||||
//{
|
||||
// if (firstDisplay && isRendered)
|
||||
// {
|
||||
// firstDisplay = false;
|
||||
// // preview SVG senza HW
|
||||
// await DoPreviewSvg(true, true);
|
||||
// }
|
||||
// List<int> reqList = SashList.Select(x => x.GroupId).ToList();
|
||||
// if (reqList.Count > 0)
|
||||
// {
|
||||
// await DoReqOptHardware(reqList);
|
||||
// }
|
||||
//}
|
||||
else
|
||||
{
|
||||
// chiedo SVG
|
||||
@@ -793,21 +806,18 @@ namespace WebWindowComplex
|
||||
#region Private Fields
|
||||
|
||||
private int currAnta = 0;
|
||||
|
||||
private int currFill = -1;
|
||||
|
||||
private int currSash = -1;
|
||||
|
||||
private int currSplit = -1;
|
||||
|
||||
private CompileStep currStep;
|
||||
|
||||
private bool editLock = false;
|
||||
private bool firstDisplay = true;
|
||||
|
||||
/// <summary>
|
||||
/// Booleana fase loading
|
||||
/// </summary>
|
||||
private bool isLoading = false;
|
||||
|
||||
private bool isRendered = false;
|
||||
|
||||
/// <summary>
|
||||
@@ -934,6 +944,18 @@ namespace WebWindowComplex
|
||||
return "btn btn-outline-secondary btn-sm";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prima chiamata alle opzioni hardware
|
||||
/// </summary>
|
||||
/// <param name="groupId"> Group Id del sash group di cui si vuole Hw option </param>
|
||||
/// <returns></returns>
|
||||
private async Task CallFirstHwOpt(int groupId)
|
||||
{
|
||||
bool isFirst = true;
|
||||
List<int> reqList = new List<int>() { groupId };
|
||||
await DoReqOptHardware(reqList, isFirst);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per settare tutti i Fill in contemporanea
|
||||
/// </summary>
|
||||
@@ -1102,14 +1124,6 @@ namespace WebWindowComplex
|
||||
return (currStep == CompileStep.Template) ? "col-8 d-grid px-2 d-md-flex justify-content-md-start" : "col-8 d-grid px-2 d-md-flex justify-content-md-start";
|
||||
}
|
||||
|
||||
private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e)
|
||||
{
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}");
|
||||
Args.Add("Jwd", e.sJwd);
|
||||
_ = EC_DoUpdate.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
private void M_CurrWindow_OnHwOption(object? sender, OnReqHwOptEventArgs e)
|
||||
{
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
@@ -1118,7 +1132,15 @@ namespace WebWindowComplex
|
||||
Args.Add("Jwd", e.sJwd);
|
||||
string listGroupId = JsonConvert.SerializeObject(new List<int> { e.nGroupId });
|
||||
Args.Add("GroupId", listGroupId);
|
||||
_ = EC_DoUpdate.InvokeAsync(Args);
|
||||
_ = EC_DoUpdate.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e)
|
||||
{
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}");
|
||||
Args.Add("Jwd", e.sJwd);
|
||||
_ = EC_DoUpdate.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
private void M_CurrWindow_OnShape(object? sender, OnReqShapeEventArgs e)
|
||||
@@ -1203,6 +1225,16 @@ namespace WebWindowComplex
|
||||
currStep = CompileStep.Tree;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta reset dizionario Shape con action
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void ReqResetDict(bool args)
|
||||
{
|
||||
_ = EC_ActionReq.InvokeAsync(DataAction.ResetDictShape);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ritorno step Tree
|
||||
/// </summary>
|
||||
@@ -1327,18 +1359,6 @@ namespace WebWindowComplex
|
||||
await DoReqOptHardware(reqList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prima chiamata alle opzioni hardware
|
||||
/// </summary>
|
||||
/// <param name="groupId"> Group Id del sash group di cui si vuole Hw option </param>
|
||||
/// <returns></returns>
|
||||
private async Task CallFirstHwOpt(int groupId)
|
||||
{
|
||||
bool isFirst = true;
|
||||
List<int> reqList = new List<int>() { groupId };
|
||||
await DoReqOptHardware(reqList, isFirst);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiornamento Sash e Frame
|
||||
/// </summary>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.7.11.315</Version>
|
||||
<Version>2.7.11.316</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
|
||||
@@ -255,6 +255,12 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user