Ejemplo n.º 1
0
        /// <summary>
        /// Links both <see cref="Display"/>s if they are adjacent. Does nothing otherwise.
        /// Adjacent means that both <see cref="Display"/>s share a border
        /// The <see cref="Display"/> passed in will be added to at most one List (<see cref="ToLeft"/>, <see cref="ToRight"/>, <see cref="Above"/>, <see cref="Below"/>)
        /// </summary>
        /// <param name="display"></param>
        public void Link(Display display)
        {
            if (display == null)
            {
                throw new ArgumentNullException(nameof(display));
            }

            if ((Bounds.Right == display.Bounds.Left) && GeometryUtil.OverlapY(Bounds, display.Bounds))
            {
                ToRight.Add(display);
            }
            else if ((Bounds.Left == display.Bounds.Right) && GeometryUtil.OverlapY(Bounds, display.Bounds))
            {
                ToLeft.Add(display);
            }
            else if ((Bounds.Top == display.Bounds.Bottom) && GeometryUtil.OverlapX(Bounds, display.Bounds))
            {
                Above.Add(display);
            }
            else if ((Bounds.Bottom == display.Bounds.Top) && GeometryUtil.OverlapX(Bounds, display.Bounds))
            {
                Below.Add(display);
            }
        }
Ejemplo n.º 2
0
 private void leftButton_Click(object sender, EventArgs e)
 {
     ToLeft?.Invoke();
 }