Example #1
0
        private IList <string> GetErrorsImpl(string propertyName)
        {
            var result            = new List <string>();
            var maxNumberOfShelfs = ElementDimension.MaximumNumberOfShelfs(this.Height);

            if (propertyName == nameof(this.NumberOfShelfs))
            {
                if (this.NumberOfShelfs > maxNumberOfShelfs)
                {
                    result.Add(string.Format("Too many shelfs; maximum for this height is {0}", maxNumberOfShelfs));
                }
            }
            else if (propertyName == nameof(this.Width))
            {
                if (this.Width != this.Parent.Width)
                {
                    result.Add("Width of item does not fit to width of element");
                }
            }

            return(result);
        }
Example #2
0
        public string this[string columnName]
        {
            get
            {
                var maxNumberOfShelfs = ElementDimension.MaximumNumberOfShelfs(this.Height);
                if (columnName == nameof(this.NumberOfShelfs))
                {
                    if (this.NumberOfShelfs > maxNumberOfShelfs)
                    {
                        return(string.Format("Too many shelfs; maximum for this height is {0}", maxNumberOfShelfs));
                    }
                }
                else if (columnName == nameof(this.Width))
                {
                    if (this.Width != this.Parent.Width)
                    {
                        return("Width of item does not fit to width of element");
                    }
                }

                return(string.Empty);
            }
        }