using WebWindowTest.Json; using static WebWindowTest.Json.WindowConst; namespace WebWindowTest.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 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); } } #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; } internal void SetFillType(FillTypes value) { m_SelFillType = value; } #endregion Internal Methods #region Private Fields private List m_FillTypeList = new List { new IdNameStruct((int)FillTypes.GLASS, "Glass"), new IdNameStruct((int)FillTypes.WOOD, "Wood") }; private FillTypes m_SelFillType; #endregion Private Fields } }