Files
webwindowconfigurator/WebWindowComplex/Models/Fill.cs
T
2025-10-29 16:52:59 +01:00

121 lines
3.1 KiB
C#

using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Models
{
public class Fill : Area
{
#region Public Constructors
public Fill(Area ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow)
{
}
#endregion Public Constructors
#region Public Properties
public FillTypes FillType
{
get
{
return (FillTypes)m_SelFillType;
}
}
public List<IdNameStruct> FillTypeList
{
get
{
return m_FillTypeList;
}
}
public FillTypes SelFillType
{
get
{
return m_SelFillType;
}
set
{
m_SelFillType = value;
}
}
public int SelFillTypeIndex
{
get
{
return IdNameStruct.IndFromId((int)m_SelFillType, m_FillTypeList);
}
set
{
m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList);
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
#endregion Public Properties
#region Public Methods
public override Fill Copy(Area newParentArea)
{
Fill newFill = new Fill(newParentArea, m_ParentWindow);
AddCounterGroup();
newFill.SetGroupId(nCounterGroup);
newFill.SetFillType(SelFillType);
newFill.SetAreaType(AreaType);
return newFill;
}
#endregion Public Methods
#region Internal Methods
internal static Fill CreateFill(Area AreaParent, FillTypes FillType)
{
Fill Fill = new Fill(AreaParent, AreaParent.ParentWindow);
AddCounterGroup();
Fill.SetGroupId(nCounterGroup);
Fill.SetAreaType(AreaTypes.FILL);
Fill.SetFillType(FillType);
return Fill;
}
internal override JsonArea Serialize(bool hideHw)
{
if (nCounterGroup < GroupId)
Area.nCounterGroup = GroupId;
JsonFill JsonFill = new JsonFill(FillType, GroupId);
foreach (var Area in AreaList)
JsonFill.AreaList.Add(Area.Serialize(hideHw));
return JsonFill;
}
internal void SetSelFillType(FillTypes value)
{
m_SelFillType = value;
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
internal void SetFillType(FillTypes value)
{
m_SelFillType = value;
}
#endregion Internal Methods
#region Private Fields
private List<IdNameStruct> m_FillTypeList = new List<IdNameStruct>
{
new IdNameStruct((int)FillTypes.GLASS, "Glass"),
new IdNameStruct((int)FillTypes.WOOD, "Wood")
};
private FillTypes m_SelFillType;
#endregion Private Fields
}
}