Aggiornamento profili degli elementi
This commit is contained in:
@@ -765,7 +765,7 @@ namespace WebWindowComplex
|
||||
// Inserisco i profili ricevuti nei rispettivi Element
|
||||
foreach (var item in LiveData.DictElement)
|
||||
{
|
||||
|
||||
UpdateProfileElement(null, item.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1049,22 +1049,45 @@ namespace WebWindowComplex
|
||||
AdvStep(CompileStep.Tree);
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per cercare un area precisa
|
||||
///// </summary>
|
||||
///// <param name="currentArea"> Area che si sta analizzando </param>
|
||||
///// <param name="idSearch"> Id Area che si sta cercando </param>
|
||||
///// <param name="itemSearch"> Area che si sta cercando </param>
|
||||
///// <returns></returns>
|
||||
//private Area SearchArea(Area currentArea, int idSearch, Area itemSearch)
|
||||
//{
|
||||
// if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(itemSearch.AreaType))
|
||||
// {
|
||||
// return currentArea;
|
||||
// }
|
||||
// foreach (Area child in currentArea.AreaList)
|
||||
// {
|
||||
// Area found = SearchArea(child, idSearch, itemSearch);
|
||||
// if (found != null)
|
||||
// {
|
||||
// return found;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per cercare un area precisa
|
||||
/// Metodo per cercare un area precisa partendo da GroupId
|
||||
/// </summary>
|
||||
/// <param name="currentArea"> Area che si sta analizzando </param>
|
||||
/// <param name="idSearch"> Id Area che si sta cercando </param>
|
||||
/// <param name="itemSearch"> Area che si sta cercando </param>
|
||||
/// <returns></returns>
|
||||
private Area SearchArea(Area currentArea, int idSearch, Area itemSearch)
|
||||
private Area SearchAreaFromGroupId(Area currentArea, int idSearch)
|
||||
{
|
||||
if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(itemSearch.AreaType))
|
||||
if (currentArea.GroupId == idSearch)
|
||||
{
|
||||
return currentArea;
|
||||
}
|
||||
foreach (Area child in currentArea.AreaList)
|
||||
{
|
||||
Area found = SearchArea(child, idSearch, itemSearch);
|
||||
Area found = SearchAreaFromGroupId(child, idSearch);
|
||||
if (found != null)
|
||||
{
|
||||
return found;
|
||||
@@ -1074,50 +1097,61 @@ namespace WebWindowComplex
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per cercare un area precisa
|
||||
/// Metodo per aggiornare i nomi dei profili degli elementi
|
||||
/// </summary>
|
||||
/// <param name="currentArea"> Area che si sta analizzando </param>
|
||||
/// <param name="idSearch"> Id Area che si sta cercando </param>
|
||||
/// <param name="index"> Indice che si sta cercando </param>
|
||||
/// <param name="profileNameList"> Lista dei profili </param>
|
||||
/// <param name="GroupIdSearch"> Id Area che si sta cercando </param>
|
||||
/// <param name="SashIdSearch"> Id dell'anta (se -1 non usare) </param>
|
||||
/// <returns></returns>
|
||||
private Area UpdateIdElement(Area currentArea, int idSearch, int index)
|
||||
private void UpdateProfileElement(List<string> profileNameList, int GroupIdSearch, int SashIdSearch = -1)
|
||||
{
|
||||
switch (currentArea.AreaType)
|
||||
// Cerco area corrispondente al GroupId
|
||||
Area found = SearchAreaFromGroupId(FrameWindow, SashIdSearch);
|
||||
switch (found.AreaType)
|
||||
{
|
||||
case AreaTypes.FRAME:
|
||||
{
|
||||
Frame frame = (Frame)currentArea;
|
||||
foreach(var item in frame.ElementDimensionList)
|
||||
Frame frame = (Frame)found;
|
||||
for(int i = 0; i < frame.ElementDimensionList.Count; i++)
|
||||
{
|
||||
//if(item.nIndex == index)
|
||||
|
||||
frame.ElementDimensionList.ElementAt(i).SetNameElement(profileNameList.ElementAt(i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AreaTypes.SASH:
|
||||
{
|
||||
Sash sash = (Sash)found;
|
||||
SashDimension anta = sash.SashList.ElementAt(SashIdSearch);
|
||||
for (int i = 0; i < anta.ElementDimensionList.Count; i++)
|
||||
{
|
||||
anta.ElementDimensionList.ElementAt(i).SetNameElement(profileNameList.ElementAt(i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AreaTypes.SPLIT:
|
||||
{
|
||||
Split split = (Split)found;
|
||||
for (int i = 0; i < split.ElemDimHorizList.Count; i++)
|
||||
{
|
||||
split.ElemDimHorizList.ElementAt(i).SetNameElement(profileNameList.ElementAt(i));
|
||||
}
|
||||
for (int i = split.ElemDimHorizList.Count; i < split.ElemDimVertList.Count; i++)
|
||||
{
|
||||
split.ElemDimVertList.ElementAt(i).SetNameElement(profileNameList.ElementAt(i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (Area child in currentArea.AreaList)
|
||||
foreach (Area child in found.AreaList)
|
||||
{
|
||||
Area found = UpdateIdElement(child, idSearch, index);
|
||||
if (found != null)
|
||||
{
|
||||
return found;
|
||||
}
|
||||
UpdateProfileElement(profileNameList, GroupIdSearch, SashIdSearch);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare valori della sezione General
|
||||
/// </summary>
|
||||
/// <param name="newVal"></param>
|
||||
/// <param name="args"></param>
|
||||
private void UpdatePreviewGeneral(DataUpdateGeneral args)
|
||||
{
|
||||
string Color = args.Color;
|
||||
@@ -1209,7 +1243,7 @@ namespace WebWindowComplex
|
||||
if (newFill != null)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = (Fill)SearchArea(FrameWindow, newFill.GroupId, newFill);
|
||||
var currRec = (Fill)SearchAreaFromGroupId(FrameWindow, newFill.GroupId);
|
||||
// lo aggiorno
|
||||
currRec = newFill;
|
||||
await DoPreviewSvg();
|
||||
@@ -1302,7 +1336,7 @@ namespace WebWindowComplex
|
||||
if (newSash != null)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash);
|
||||
var currRec = SearchAreaFromGroupId(FrameWindow, newSash.GroupId);
|
||||
// lo aggiorno
|
||||
currRec = newSash;
|
||||
// resetto hw lst
|
||||
@@ -1325,7 +1359,7 @@ namespace WebWindowComplex
|
||||
if (newSash != null)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash);
|
||||
var currRec = SearchAreaFromGroupId(FrameWindow, newSash.GroupId);
|
||||
// lo aggiorno
|
||||
currRec = newSash;
|
||||
// resetto hw lst
|
||||
@@ -1350,7 +1384,7 @@ namespace WebWindowComplex
|
||||
if (newSplit != null)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = SearchArea(FrameWindow, newSplit.GroupId, newSplit);
|
||||
var currRec = SearchAreaFromGroupId(FrameWindow, newSplit.GroupId);
|
||||
// lo aggiorno
|
||||
currRec = newSplit;
|
||||
if (!noSvg)
|
||||
@@ -1372,7 +1406,7 @@ namespace WebWindowComplex
|
||||
{
|
||||
if (currSplitted != null)
|
||||
{
|
||||
var item = SearchArea(FrameWindow, currSplitted.GroupId, currSplitted);
|
||||
var item = SearchAreaFromGroupId(FrameWindow, currSplitted.GroupId);
|
||||
item = currSplitted;
|
||||
// ricalcolo liste
|
||||
UpdateLists();
|
||||
@@ -1396,7 +1430,7 @@ namespace WebWindowComplex
|
||||
bool noSvg = args.noSvg;
|
||||
if (svgNoHw)
|
||||
{
|
||||
Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash);
|
||||
Sash item = (Sash)SearchAreaFromGroupId(FrameWindow, newSash.GroupId);
|
||||
if (newSash != null && item != null)
|
||||
{
|
||||
item = newSash;
|
||||
@@ -1405,7 +1439,7 @@ namespace WebWindowComplex
|
||||
}
|
||||
else
|
||||
{
|
||||
Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash);
|
||||
Sash item = (Sash)SearchAreaFromGroupId(FrameWindow, newSash.GroupId );
|
||||
if (newSash != null && item != null)
|
||||
{
|
||||
item = newSash;
|
||||
|
||||
Reference in New Issue
Block a user