using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models { public class ElementDimension { #region Public Constructors public ElementDimension(Area ParentArea, int nIndex, double dDimension) { m_ParentArea = ParentArea; m_nIndex = nIndex; m_dDimension = dDimension; } #endregion Public Constructors #region Public Properties public double dDimension { get { return m_dDimension; } set { if(dDimension != value) { if (value > m_dMax) m_dDimension = m_dMax; else if (value < m_dMin) m_dDimension = m_dMin; else m_dDimension = value; } } } public int nIndex { get { return m_nIndex; } } public string sName { get { return m_sName; } set { if (m_sName != value) { m_sName = value; } } } public Area ParentArea { get { return m_ParentArea; } } #endregion Public Properties #region Public Methods public void SetDimension(double dValue) { m_dDimension = dValue; } public void SetMaxDimension(double dValue) { m_dMax = dValue; } public void SetMinDimension(double dValue) { m_dMin = dValue; } public void SetNameElement(string dValue) { m_sName = dValue; } public ElementDimension Copy() { ElementDimension newElementDimension = new ElementDimension(ParentArea, nIndex, dDimension); return newElementDimension; } #endregion Public Methods #region Internal Methods internal JsonElementDimension Serialize() { JsonElementDimension JsonElementDimension = new JsonElementDimension(m_nIndex, m_dDimension); return JsonElementDimension; } #endregion Internal Methods #region Protected Fields protected Area m_ParentArea; #endregion Protected Fields #region Private Fields private double m_dDimension; private int m_nIndex; private string m_sName; private double m_dMin; private double m_dMax; #endregion Private Fields } }