Example #1
0
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public BordersModel Clone()
        {
            var bordersCloned = new BordersModel(Parent)
            {
                Properties = Properties.Clone()
            };

            foreach (var border in this)
            {
                border.SetOwner(bordersCloned);
                bordersCloned.Add(border.Clone());
            }

            return(bordersCloned);
        }
Example #2
0
        /// <summary>
        /// Combines this instance with reference parameter.
        /// </summary>
        /// <param name="reference">The reference.</param>
        public void Combine(BordersModel reference)
        {
            var hasElements = this.Any();

            if (!hasElements)
            {
                foreach (var referenceBorder in reference)
                {
                    var border = referenceBorder.Clone();
                    border.SetOwner(this);
                    Add(border);
                }
            }
            else
            {
                foreach (var border in this)
                {
                    var refborder = reference.GetBy(border.Position);
                    if (refborder != null)
                    {
                        border.Combine(refborder);
                    }
                }

                foreach (var referenceBorder in reference)
                {
                    var border = GetBy(referenceBorder.Position);
                    if (border != null)
                    {
                        continue;
                    }

                    var newBorder = referenceBorder.Clone();
                    newBorder.SetOwner(this);
                    Add(newBorder);
                }
            }
        }
Example #3
0
 /// <summary>
 /// Sets the element that owns this <see cref="T:iTin.Export.Model.BorderModel" />.
 /// </summary>
 /// <param name="reference">Reference to owner.</param>
 internal void SetOwner(BordersModel reference)
 {
     _owner = reference;
 }