Corretti alcuni Warnings

This commit is contained in:
Annamaria Sassi
2026-01-28 11:26:54 +01:00
parent 3f96d71c30
commit ce8bd4fafc
27 changed files with 479 additions and 435 deletions
+3 -2
View File
@@ -54,9 +54,10 @@ namespace WebWindowComplex.Models
{
foreach (var Value in HdwOptionParam.Opzioni)
m_ValueList.Add(Value.Valore);
m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente);
if(m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente) != null)
m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente)!;
if (string.IsNullOrEmpty(m_sValue))
m_sValue = m_ValueList.FirstOrDefault();
m_sValue = m_ValueList.FirstOrDefault()!;
}
else
{
+47 -44
View File
@@ -470,72 +470,75 @@ namespace WebWindowComplex.Models
/// <returns></returns>
public double CalculateWidthArea(Area area, double width)
{
for (int i = 0; i < area.AreaList.Count; i++)
if(width > 0)
{
double risultato = -1;
if (area.Equals(this))
return width;
Area item = area.AreaList[i];
if (area is Split)
for (int i = 0; i < area.AreaList.Count; i++)
{
Split split = (Split)area;
if (split.SplitVertList.Count > 0)
double risultato = -1;
if (area.Equals(this))
return width;
Area item = area.AreaList[i];
if (area is Split)
{
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
Split split = (Split)area;
if (split.SplitVertList.Count > 0)
{
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
risultato = CalculateWidthArea(item, ConvertFromPropVal(split.SplitVertList, split.SplitVertList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
break;
}
}
}
else
{
risultato = CalculateWidthArea(item, width);
}
if (risultato != -1)
return risultato;
}
else if (area is Sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension);
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
risultato = CalculateWidthArea(item, ConvertFromPropVal(split.SplitVertList, split.SplitVertList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
risultato = CalculateWidthArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension * width / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateWidthArea(item, width);
if (risultato != -1)
return risultato;
}
if (risultato != -1)
return risultato;
}
else if (area is Sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
risultato = CalculateWidthArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension * width / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateWidthArea(item, width);
if (risultato != -1)
return risultato;
}
}
return width;
+1 -1
View File
@@ -136,7 +136,7 @@ namespace WebWindowComplex.Models
private int m_nIndex;
private string m_sName;
private string m_sName = "";
private double m_dMin;
+14 -10
View File
@@ -21,7 +21,7 @@ namespace WebWindowComplex.Models
#region Public Constructors
public Frame(Area ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow)
public Frame(Area? ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow)
{
}
@@ -443,7 +443,7 @@ namespace WebWindowComplex.Models
public override Frame Copy(Area ParentArea)
{
return null;
return new Frame(null, ParentWindow);
}
#endregion Public Methods
@@ -465,7 +465,7 @@ namespace WebWindowComplex.Models
newFrame.RefreshThresholdList();
if (m_AllThresholdList != null && m_AllThresholdList.Any())
{
newFrame.SetSelThresholdFromName(m_AllThresholdList.FirstOrDefault().Name ?? "");
newFrame.SetSelThresholdFromName(m_AllThresholdList.FirstOrDefault()?.Name ?? "");
}
//newFrame.FrameArcElem = null;
return newFrame;
@@ -679,12 +679,16 @@ namespace WebWindowComplex.Models
/// <returns></returns>
internal double AvailArea()
{
// larghezza - elementDim(1) - elementDim(last) + overlapDd + overlapSx
return DimensionList.FirstOrDefault(x => x.sName.Equals("Width")).dDimension -
ElementDimensionList.ElementAt(1).dDimension -
ElementDimensionList.Last().dDimension +
ElementDimensionList.ElementAt(1).dOverlap +
ElementDimensionList.Last().dOverlap;
if(DimensionList.Count> 0 && DimensionList.FirstOrDefault(x => x.sName.Equals("Width")) != null)
{
// larghezza - elementDim(1) - elementDim(last) + overlapDd + overlapSx
return DimensionList.FirstOrDefault(x => x.sName.Equals("Width"))!.dDimension -
ElementDimensionList.ElementAt(1).dDimension -
ElementDimensionList.Last().dDimension +
ElementDimensionList.ElementAt(1).dOverlap +
ElementDimensionList.Last().dOverlap;
}
return -1;
//switch (m_Shape)
//{
// case Shapes.RECTANGLE:
@@ -742,7 +746,7 @@ namespace WebWindowComplex.Models
private bool m_bBottomRail;
private Threshold m_SelThreshold;
private Threshold m_SelThreshold = new Threshold(1, "");
private List<Threshold> m_ThresholdList = new List<Threshold>();
@@ -14,8 +14,6 @@ namespace WebWindowComplex.Models
{
#region Public Constructors
public FrameArcElement() { }
public FrameArcElement(Area ParentArea, Window ParentWindow, double nSection, bool bCutEdge, bool bIsAlign)
{
m_ParentArea = ParentArea;
+11 -10
View File
@@ -276,7 +276,7 @@ namespace WebWindowComplex.Models
if (value > 0)
{
double dLastDimension = 0;
SashDimension itemDelete = null;
SashDimension itemDelete = new SashDimension(0, MeasureTypes.NULL, this, 0);
double deleteDim;
for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1)
{
@@ -476,7 +476,7 @@ namespace WebWindowComplex.Models
{
get
{
return m_SelHardware;
return m_SelHardware!;
}
set
{
@@ -492,7 +492,7 @@ namespace WebWindowComplex.Models
{
get
{
return m_SelHardware.Id;
return m_SelHardware!.Id;
}
set
{
@@ -570,7 +570,7 @@ namespace WebWindowComplex.Models
Area newArea = item.Copy(newSash);
newSash.AreaList.Add(newArea);
}
newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id);
newSash.SetSelFamilyHardwareFromIndex(m_SelHardware!.Id);
newSash.SetSelHardwareFromId(CustomHwId);
//if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC ||
@@ -592,7 +592,7 @@ namespace WebWindowComplex.Models
m_HardwareList.Clear();
Enums.OpeningTypes sOpeningType = ConvertOpeningType();
if (string.IsNullOrEmpty(m_SelFamilyHardware))
m_SelFamilyHardware = s_FamilyHardwareList.FirstOrDefault();
m_SelFamilyHardware = s_FamilyHardwareList.FirstOrDefault() ?? "";
int sashPosition = 1;
if (nSashQty > 2 && !(SashList.First().bHasHandle || SashList.Last().bHasHandle))
sashPosition = 2;
@@ -610,6 +610,7 @@ namespace WebWindowComplex.Models
if(rawList.Count == 0 || rawList == null)
{
Hardware hw = new Hardware(CustomHwId, m_SelFamilyHardware, "Custom", sOpeningType, m_CurrShape, nSashQty, 1);
rawList = new List<Hardware>();
rawList.Add(hw);
}
m_HardwareList = new List<Hardware>(rawList);
@@ -672,7 +673,7 @@ namespace WebWindowComplex.Models
{
RefreshHardwareList();
// se il vecchio hw selezionato non va più bene viene selezionato il primo della lista
if (!HardwareList.Contains(m_SelHardware) || m_SelHardware.Shape != m_CurrShape)
if (!HardwareList.Contains(m_SelHardware!) || m_SelHardware!.Shape != m_CurrShape)
{
SetFirstHardware();
ClearHardwareOptionList();
@@ -796,7 +797,7 @@ namespace WebWindowComplex.Models
{
if (nCounterGroup < GroupId)
Area.nCounterGroup = GroupId;
string currHwId = hideHw ? CustomHwId : m_SelHardware.Id;
string currHwId = hideHw ? CustomHwId : m_SelHardware!.Id;
JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId);
foreach (var SashDimension in SashList)
JsonSash.SashList.Add(SashDimension.Serialize());
@@ -854,11 +855,11 @@ namespace WebWindowComplex.Models
{
if (!string.IsNullOrEmpty(OptionXml))
{
ParametriOpzioni HwOptions = null;
ParametriOpzioni HwOptions = new ParametriOpzioni();
XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni));
StringReader reader = new StringReader(OptionXml);
HwOptions = (ParametriOpzioni)serializer.Deserialize(reader);
if (HwOptions.Items != null)
if (HwOptions!.Items != null)
{
m_HwOptionList.Clear();
foreach (var HwOption in HwOptions.Items)
@@ -1031,7 +1032,7 @@ namespace WebWindowComplex.Models
private List<SashDimension> m_SashList = new List<SashDimension>();
private SashTypes m_SashType;
private string m_SelFamilyHardware = "";
private Hardware m_SelHardware;
private Hardware? m_SelHardware = null;
private OrientationSash m_SelOrientationSashType;
//private SashArcElement m_SashArcElement;
@@ -14,8 +14,6 @@ namespace WebWindowComplex.Models
{
#region Public Constructors
public SashArcElement() { }
public SashArcElement(Area ParentArea, Window ParentWindow, double nSection, bool bCutEdge)
{
m_ParentArea = ParentArea;
+180 -170
View File
@@ -149,168 +149,171 @@ namespace WebWindowComplex.Models
}
set
{
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
//double widthTot = ((Frame)m_Parent.ParentArea).AvailArea();
double valMinAbsolute = 100;
double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1);
bool valueAccept = false;
switch (MeasureType)
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
{
case MeasureTypes.ABSOLUTE:
{
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
case MeasureTypes.PROPORTIONAL:
{
valMaxAbsolute = 20;
valueAccept = (value >= 1) ? true : false;
break;
}
case MeasureTypes.PERCENTAGE:
{
valMaxAbsolute = valMaxAbsolute / widthTot * 100;
valMinAbsolute = valMinAbsolute / widthTot * 100;
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
}
if (valueAccept)
{
List<SashDimension> dimensions = m_Parent.SashList;
List<double> absoluteValList = new List<double>();
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in m_Parent.SashList)
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
//double widthTot = ((Frame)m_Parent.ParentArea).AvailArea();
double valMinAbsolute = 100;
double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1);
bool valueAccept = false;
switch (MeasureType)
{
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
case MeasureTypes.ABSOLUTE:
{
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
case MeasureTypes.PROPORTIONAL:
{
valMaxAbsolute = 20;
valueAccept = (value >= 1) ? true : false;
break;
}
case MeasureTypes.PERCENTAGE:
{
valMaxAbsolute = valMaxAbsolute / widthTot * 100;
valMinAbsolute = valMinAbsolute / widthTot * 100;
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
}
int index = 0;
foreach (var item in m_Parent.SashList)
if (valueAccept)
{
absoluteValList.Add(adList.ElementAt(index).CalculateAbsoluteValue(adList, widthTot));
index++;
}
int nIndex = dimensions.IndexOf(this);
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count;
// Le dimensioni sono solo in proporzionale
if (proportionalCount == absoluteValList.Count || SelMeasureType.Equals(MeasureTypes.PROPORTIONAL) ||
(SelMeasureType.Equals(MeasureTypes.ABSOLUTE) && proportionalCount == absoluteValList.Count -1))
{
m_dDimension = value;
}
// Le dimensioni sono solo in percentuale
else if (percentageCount == dimensions.Count)
{
if (value < m_dDimension)
List<SashDimension> dimensions = m_Parent.SashList;
List<double> absoluteValList = new List<double>();
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in m_Parent.SashList)
{
// L'anta modificata non è l'ultima
if (nIndex < dimensions.Count - 1)
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].m_dDimension + (m_dDimension - value));
else if (dimensions.Count > 1)
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].m_dDimension + (m_dDimension - value));
else
{
m_dDimension = 100;
return;
}
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
}
else
int index = 0;
foreach (var item in m_Parent.SashList)
{
double dRes = value;
// se non ultima anta
if (nIndex < dimensions.Count - 1)
{
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
dRes += dimensions[nInd].m_dDimension;
dRes = (100 - dRes) / (dimensions.Count - nIndex - 1);
for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++)
dimensions[Ind].SetDimension(dRes);
}
// se ultima anta
else if (dimensions.Count > 1)
{
if (dimensions.Count > 2)
{
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
dRes += dimensions[Ind].m_dDimension;
}
dRes = (100 - dRes);
dimensions[nIndex - 1].SetDimension(dRes);
}
else
{
m_dDimension = 100;
return;
}
absoluteValList.Add(adList.ElementAt(index).CalculateAbsoluteValue(adList, widthTot));
index++;
}
m_dDimension = value;
}
// Le dimensioni sono miste o solo in assoluto
else
{
double valueInAbsolute = 0;
switch (MeasureType)
int nIndex = dimensions.IndexOf(this);
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count;
// Le dimensioni sono solo in proporzionale
if (proportionalCount == absoluteValList.Count || SelMeasureType.Equals(MeasureTypes.PROPORTIONAL) ||
(SelMeasureType.Equals(MeasureTypes.ABSOLUTE) && proportionalCount == absoluteValList.Count -1))
{
case MeasureTypes.ABSOLUTE:
{
valueInAbsolute = value;
break;
}
case MeasureTypes.PROPORTIONAL:
{
var pesi = value + dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
.Sum(x => x.m_dDimension);
valueInAbsolute = widthTot / pesi * value;
break;
}
case MeasureTypes.PERCENTAGE:
{
valueInAbsolute = (value / 100) * widthTot;
break;
}
}
if (value < m_dDimension)
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
}
else
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
}
if (MeasureType.Equals(MeasureTypes.PROPORTIONAL))
m_dDimension = value;
for (int i = 0; i < absoluteValList.Count; i++)
{
var item = m_Parent.SashList.ElementAt(i);
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
}
// Le dimensioni sono solo in percentuale
else if (percentageCount == dimensions.Count)
{
if (value < m_dDimension)
{
// L'anta modificata non è l'ultima
if (nIndex < dimensions.Count - 1)
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].m_dDimension + (m_dDimension - value));
else if (dimensions.Count > 1)
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].m_dDimension + (m_dDimension - value));
else
{
m_dDimension = 100;
return;
}
}
else
{
double dRes = value;
// se non ultima anta
if (nIndex < dimensions.Count - 1)
{
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
dRes += dimensions[nInd].m_dDimension;
dRes = (100 - dRes) / (dimensions.Count - nIndex - 1);
for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++)
dimensions[Ind].SetDimension(dRes);
}
// se ultima anta
else if (dimensions.Count > 1)
{
if (dimensions.Count > 2)
{
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
dRes += dimensions[Ind].m_dDimension;
}
dRes = (100 - dRes);
dimensions[nIndex - 1].SetDimension(dRes);
}
else
{
m_dDimension = 100;
return;
}
}
m_dDimension = value;
}
// Le dimensioni sono miste o solo in assoluto
else
{
double valueInAbsolute = 0;
switch (MeasureType)
{
case MeasureTypes.ABSOLUTE:
{
valueInAbsolute = value;
break;
}
case MeasureTypes.PROPORTIONAL:
{
var pesi = value + dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
.Sum(x => x.m_dDimension);
valueInAbsolute = widthTot / pesi * value;
break;
}
case MeasureTypes.PERCENTAGE:
{
valueInAbsolute = (value / 100) * widthTot;
break;
}
}
if (value < m_dDimension)
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
}
else
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
}
if (MeasureType.Equals(MeasureTypes.PROPORTIONAL))
m_dDimension = value;
for (int i = 0; i < absoluteValList.Count; i++)
{
var item = m_Parent.SashList.ElementAt(i);
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
}
}
foreach(var item in m_Parent.AreaList)
item.SearchAreaList(item, dDimension, "Width");
}
foreach(var item in m_Parent.AreaList)
item.SearchAreaList(item, dDimension, "Width");
}
}
}
@@ -405,16 +408,18 @@ namespace WebWindowComplex.Models
if(SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in m_Parent.SashList)
if (m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
{
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in m_Parent.SashList)
{
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
}
m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId-1);
SelMeasureType = (MeasureTypes)value;
}
m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId-1);
//m_dDimension = Convert.ConvertDimension(this, m_SelMeasureType, newType, m_dDimension, widthTot);
SelMeasureType = (MeasureTypes)value;
}
}
}
@@ -458,6 +463,8 @@ namespace WebWindowComplex.Models
/// <returns></returns>
internal double CalculateWidthSashGroup(Area area, double width)
{
if (width < 1)
return width;
for(int i = 0; i < area.AreaList.Count; i++)
{
double risultato = -1;
@@ -577,20 +584,23 @@ namespace WebWindowComplex.Models
if (SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach(var item in m_Parent.SashList)
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
{
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach(var item in m_Parent.SashList)
{
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
}
m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash);
if(newType is MeasureTypes.PROPORTIONAL)
{
for (int i = 0; i < newDimensions.Count; i++)
m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
}
SelMeasureType = (MeasureTypes)value;
}
m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash);
if(newType is MeasureTypes.PROPORTIONAL)
{
for (int i = 0; i < newDimensions.Count; i++)
m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
}
SelMeasureType = (MeasureTypes)value;
}
}
+79 -76
View File
@@ -152,81 +152,84 @@ namespace WebWindowComplex.Models
}
else
{
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitVertList.Count - 1)
if(ParentWindow.AreaList.FirstOrDefault() != null)
{
// recupero larghezza ultimo
double dLastDimension = widthTot;
double dNewDimension = widthTot;
if (m_SplitVertList.Count > 0)
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension);
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitVertList.Count - 1)
{
dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
if (m_SplitVertList[m_SplitVertList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
dNewDimension = 1;
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension);
}
else
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
// aggiungo area Split di default
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++)
m_SplitVertList.Add(new SplitDimension(dNewDimension, m_SplitVertList[m_SplitVertList.Count - 1].MeasureType, true, this, true));
}
else if (value == 0)
{
m_SplitVertList.RemoveAt(1);
m_SplitVertList.RemoveAt(0);
}
// Ricalcolo dimensioni rimuovendo split
else
{
int countProportional = m_SplitVertList.Count(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL));
if(m_SplitVertList.Last().MeasureType.Equals(MeasureTypes.PROPORTIONAL) && countProportional - 1 == 1)
{
m_SplitVertList.RemoveAt(m_SplitVertList.Count() - 1);
m_SplitVertList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).FirstOrDefault().SetDimension(1);
}
else
{
double dLastDimension = 0;
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
// recupero larghezza ultimo
double dLastDimension = widthTot;
double dNewDimension = widthTot;
if (m_SplitVertList.Count > 0)
{
dLastDimension += m_SplitVertList[SplitIndex].dDimension;
m_SplitVertList.RemoveAt(SplitIndex);
dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
if (m_SplitVertList[m_SplitVertList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
dNewDimension = 1;
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension);
}
dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dLastDimension);
else
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
// aggiungo area Split di default
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++)
m_SplitVertList.Add(new SplitDimension(dNewDimension, m_SplitVertList[m_SplitVertList.Count - 1].MeasureType, true, this, true));
}
ElemDimVertList.RemoveAt(ElemDimVertList.Count - 1);
}
// Controllo quanti split orizzontali ci sono
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitVertList.Count * nHoriz) - 1; SplitIndex++)
{
AreaList.Add(Splitted.CreateSplitted(this));
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
}
// Se ho più di uno split, elimino l'ultimo
if (AreaList.Count > 2)
{
int nAreaList = AreaList.Count - 1;
for (var SplitIndex = (m_SplitVertList.Count * nHoriz); SplitIndex <= nAreaList; SplitIndex++)
else if (value == 0)
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
m_SplitVertList.RemoveAt(1);
m_SplitVertList.RemoveAt(0);
}
// Ricalcolo dimensioni rimuovendo split
else
{
int countProportional = m_SplitVertList.Count(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL));
if(m_SplitVertList.Last().MeasureType.Equals(MeasureTypes.PROPORTIONAL) && countProportional - 1 == 1)
{
m_SplitVertList.RemoveAt(m_SplitVertList.Count() - 1);
m_SplitVertList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).FirstOrDefault()?.SetDimension(1);
}
else
{
double dLastDimension = 0;
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
{
dLastDimension += m_SplitVertList[SplitIndex].dDimension;
m_SplitVertList.RemoveAt(SplitIndex);
}
dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dLastDimension);
}
ElemDimVertList.RemoveAt(ElemDimVertList.Count - 1);
}
// Controllo quanti split orizzontali ci sono
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitVertList.Count * nHoriz) - 1; SplitIndex++)
{
AreaList.Add(Splitted.CreateSplitted(this));
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
}
// Se ho più di uno split, elimino l'ultimo
if (AreaList.Count > 2)
{
int nAreaList = AreaList.Count - 1;
for (var SplitIndex = (m_SplitVertList.Count * nHoriz); SplitIndex <= nAreaList; SplitIndex++)
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
}
}
// Se elimino l'unico split presente
else
{
Splitted s = (Splitted)AreaList[0];
s.SetParentArea(ParentArea);
ParentArea.AreaList.Add(s);
ParentArea.AreaList.Remove(this);
}
}
// Se elimino l'unico split presente
else
{
Splitted s = (Splitted)AreaList[0];
s.SetParentArea(ParentArea);
ParentArea.AreaList.Add(s);
ParentArea.AreaList.Remove(this);
}
}
if(SplitHorizList.Count > 0)
@@ -418,7 +421,7 @@ namespace WebWindowComplex.Models
{
foreach (var areaSplitted in AreaList)
{
if (!(areaSplitted.AreaList.FirstOrDefault().AreaType is AreaTypes.SASH))
if (!(areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH))
return false;
}
return true;
@@ -427,7 +430,7 @@ namespace WebWindowComplex.Models
{
foreach (var areaSplitted in AreaList)
{
if (areaSplitted.AreaList.FirstOrDefault().AreaType is AreaTypes.SASH)
if (areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH)
return true;
}
return false;
@@ -436,7 +439,7 @@ namespace WebWindowComplex.Models
{
foreach (var areaSplitted in AreaList)
{
if (areaSplitted.AreaList.FirstOrDefault().AreaType is AreaTypes.SASH)
if (areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH)
return true;
}
return false;
@@ -577,19 +580,19 @@ namespace WebWindowComplex.Models
case (int)Shapes.TRIANGLE:
case (int)Shapes.ARC_FULL:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dDimension;
return ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Height").First().dDimension;
}
case (int)Shapes.RIGHTCHAMFER:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
return ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
}
case (int)Shapes.LEFTCHAMFER:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
return ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
}
default:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
return ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
}
}
}
@@ -598,7 +601,7 @@ namespace WebWindowComplex.Models
#region Private Fields
private bool m_bIsPercentage = true;
//private bool m_bIsPercentage = true;
private bool m_bSplitStartVert = true;
private SplitShapes m_SelSplitShape;
+58 -52
View File
@@ -50,8 +50,8 @@ namespace WebWindowComplex.Models
set
{
double dimensionTot = 0;
List<SplitDimension> dimensions = null;
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
List<SplitDimension> dimensions = new List<SplitDimension>();
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault()?? new Frame(null, Parent.ParentWindow);
if (bIsVertListDim)
{
dimensions = m_Parent.SplitVertList;
@@ -252,27 +252,30 @@ namespace WebWindowComplex.Models
if (m_SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
List<SplitDimension> splitList = null;
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
double tot = 0;
if (bIsVertListDim)
List<SplitDimension> splitList = new List<SplitDimension>();
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
{
splitList = m_Parent.SplitVertList;
tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault()!;
double tot = 0;
if (bIsVertListDim)
{
splitList = m_Parent.SplitVertList;
tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
}
else
{
splitList = m_Parent.SplitHorizList;
tot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
}
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in splitList)
{
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
}
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this));
m_SelMeasureType = (MeasureTypes)value;
}
else
{
splitList = m_Parent.SplitHorizList;
tot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
}
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> adList = new List<AreaDimension>();
foreach (var it in splitList)
{
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
}
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this));
m_SelMeasureType = (MeasureTypes)value;
}
}
}
@@ -490,45 +493,48 @@ namespace WebWindowComplex.Models
if (m_SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
double dimSplitGroup = 0;
if (bIsVertListDim)
if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null)
{
dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension;
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach (var item in m_Parent.SplitVertList)
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault()!;
double dimSplitGroup = 0;
if (bIsVertListDim)
{
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
}
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this));
if (newType is MeasureTypes.PROPORTIONAL)
{
for (int i = 0; i < m_Parent.SplitVertList.Count; i++)
dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension;
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach (var item in m_Parent.SplitVertList)
{
m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
}
} }
else
{
//tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension;
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach (var item in m_Parent.SplitHorizList)
{
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
}
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this));
if(newType is MeasureTypes.PROPORTIONAL)
{
for(int i = 0; i < m_Parent.SplitHorizList.Count; i++)
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this));
if (newType is MeasureTypes.PROPORTIONAL)
{
m_Parent.SplitHorizList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
for (int i = 0; i < m_Parent.SplitVertList.Count; i++)
{
m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
}
} }
else
{
//tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension;
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
List<AreaDimension> newDimensions = new List<AreaDimension>();
foreach (var item in m_Parent.SplitHorizList)
{
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
}
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this));
if(newType is MeasureTypes.PROPORTIONAL)
{
for(int i = 0; i < m_Parent.SplitHorizList.Count; i++)
{
m_Parent.SplitHorizList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
}
}
}
m_SelMeasureType = (MeasureTypes)value;
}
m_SelMeasureType = (MeasureTypes)value;
}
}
+4 -4
View File
@@ -143,10 +143,10 @@ namespace WebWindowComplex.Models
#region Private Fields
private List<Frame> m_AreaList = new List<Frame>();
private string m_sColorMaterial;
private string m_sGlass;
private string m_sMaterial;
private string m_sProfilePath;
private string? m_sColorMaterial;
private string? m_sGlass;
private string? m_sMaterial;
private string? m_sProfilePath;
#endregion Private Fields
}