update x gestioen richeiste forme + svg corrette
This commit is contained in:
@@ -432,7 +432,7 @@ namespace WebWindowComplex
|
||||
/// Richiesta update anteprima SVG
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected async Task DoPreviewSvg()
|
||||
protected async Task DoPreviewSvg(bool doForce = false)
|
||||
{
|
||||
if (m_CurrWindow != null)
|
||||
{
|
||||
@@ -442,7 +442,7 @@ namespace WebWindowComplex
|
||||
var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize());
|
||||
#endif
|
||||
// verifico variazione JWD
|
||||
if (!prevJwd.Equals(CurrJwd))
|
||||
if (!prevJwd.Equals(CurrJwd) || doForce)
|
||||
{
|
||||
prevJwd = CurrJwd;
|
||||
Dictionary<string, string> Args = new Dictionary<string, string>();
|
||||
@@ -482,9 +482,9 @@ namespace WebWindowComplex
|
||||
/// <summary>
|
||||
/// Richiesta Shape compatibile da JWD
|
||||
/// </summary>
|
||||
/// <param name="groupId">ID numerico del gruppo da valutare</param>
|
||||
/// <param name="groupIdList">Lista degli ID numerici dei gruppi da valutare</param>
|
||||
/// <returns></returns>
|
||||
protected async Task DoReqShape(int groupId)
|
||||
protected async Task DoReqShape(List<int> groupIdList)
|
||||
{
|
||||
if (m_CurrWindow != null)
|
||||
{
|
||||
@@ -501,7 +501,8 @@ namespace WebWindowComplex
|
||||
Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}");
|
||||
Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.SASHSHAPE}");
|
||||
Args.Add("Jwd", CurrJwd);
|
||||
Args.Add("GroupId", $"{groupId}");
|
||||
string listGroupId = JsonConvert.SerializeObject(groupIdList);
|
||||
Args.Add("GroupId", listGroupId);
|
||||
await EC_DoUpdate.InvokeAsync(Args);
|
||||
}
|
||||
}
|
||||
@@ -562,16 +563,51 @@ namespace WebWindowComplex
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
// SOLO SE sono presenti...
|
||||
if (ListPayload.IsPopulated() && LiveData.IsValid())
|
||||
{
|
||||
bool updateSvg = false;
|
||||
bool updRequested = false;
|
||||
listErrPre = new Dictionary<string, string>();
|
||||
listErrLink = new Dictionary<string, string>();
|
||||
listWarnings = new Dictionary<string, string>();
|
||||
// controllo elenchi BasePayload siano validi...
|
||||
if (ListPayload.IsValid())
|
||||
{
|
||||
// SOLO SE modificato live data...
|
||||
if (prevLiveData == null || !prevLiveData.Equals(LiveData))
|
||||
{
|
||||
updRequested = true;
|
||||
prevLiveData = new LivePayload()
|
||||
{
|
||||
CurrJwd = LiveData.CurrJwd,
|
||||
OptionsXml = LiveData.OptionsXml,
|
||||
DictShape = LiveData.DictShape,
|
||||
SvgPreview = LiveData.SvgPreview
|
||||
};
|
||||
m_SelSVG = LiveData.SvgPreview;
|
||||
// Aggiornati parametri di ingresso selezionati
|
||||
UpdateSelParameter();
|
||||
JsonWindow WindowFromJson = new JsonWindow("", "", "", "");
|
||||
// provo a deserializzare
|
||||
try
|
||||
{
|
||||
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}");
|
||||
}
|
||||
}
|
||||
checkWarnings();
|
||||
#if false
|
||||
// controllo sia popolato anche per la componente LIVE
|
||||
if (LiveData.IsValid())
|
||||
{
|
||||
@@ -632,14 +668,28 @@ namespace WebWindowComplex
|
||||
}
|
||||
}
|
||||
updateSvg = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (SashList.Count > 0)
|
||||
{
|
||||
currAnta = 0;
|
||||
}
|
||||
if (updateSvg)
|
||||
if (updRequested)
|
||||
{
|
||||
await DoPreviewSvg();
|
||||
// se mancasse dizionario forme chiamo quello
|
||||
if (LiveData.DictShape.Count == 0)
|
||||
{
|
||||
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
|
||||
if (reqList.Count > 0)
|
||||
{
|
||||
await DoReqShape(reqList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// chiedo SVG
|
||||
await DoPreviewSvg(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -674,6 +724,13 @@ namespace WebWindowComplex
|
||||
}
|
||||
if (SashList.Count > 0)
|
||||
currAnta = 0;
|
||||
// se ho i dizionari delle forme le aggiungo
|
||||
if (LiveData.DictShape.Count > 0)
|
||||
{
|
||||
// ToDo....
|
||||
|
||||
// aggiorno SVG
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1203,10 +1260,14 @@ namespace WebWindowComplex
|
||||
{
|
||||
FrameWindow = newFrame;
|
||||
// ciclo x ogni group della mia frame
|
||||
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
|
||||
await DoReqShape(reqList);
|
||||
#if false
|
||||
foreach (var item in SashList)
|
||||
{
|
||||
await DoReqShape(item.GroupId);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1216,7 +1277,11 @@ namespace WebWindowComplex
|
||||
/// <returns></returns>
|
||||
private async Task UpdateShape(int groupId)
|
||||
{
|
||||
await DoReqShape(groupId);
|
||||
List<int> reqList = new List<int>() { groupId };
|
||||
await DoReqShape(reqList);
|
||||
#if false
|
||||
await DoReqShape(groupId);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user