public WindowSizingEventArgs(DesktopWindow window, SizingCorner corner, Int32Rect initialPosition, Int32Rect lastPosition, Int32Rect currentPosition)
     : base(window)
 {
     this.Corner = corner;
     this.InitialPosition = initialPosition;
     this.LastPosition = lastPosition;
     this.CurrentPosition = currentPosition;
 }
Beispiel #2
0
        public void ReportSizeChange(DesktopWindow window, SizingCorner sizingCorner, Int32Rect initialPosition, Int32Rect lastPosition, Int32Rect currentPosition)
        {
            var layout = screens.Values.Where(l => l.Contains(window)).SingleOrDefault();
            if (layout == null)
                return;

            bool leftColumnContainsWindow = layout.LeftColumn.Contains(window);

            if (leftColumnCorners.Contains(sizingCorner) && leftColumnContainsWindow)
            {
                int combinedWidth = layout.LeftColumn.Area.Width + layout.RightColumn.Area.Width;
                layout.LeftColumn.Area = new Int32Rect(layout.LeftColumn.Area.X, layout.LeftColumn.Area.Y, currentPosition.Width, layout.LeftColumn.Area.Height);
                layout.RightColumn.Area = new Int32Rect(layout.LeftColumn.Area.Width, layout.RightColumn.Area.Y, combinedWidth - layout.LeftColumn.Area.Width, layout.RightColumn.Area.Height);
            }

            if (rightColumnCorners.Contains(sizingCorner) && !leftColumnContainsWindow)
            {
                int combinedWidth = layout.LeftColumn.Area.Width + layout.RightColumn.Area.Width;
                layout.RightColumn.Area = new Int32Rect(currentPosition.X, layout.RightColumn.Area.Y, currentPosition.Width, layout.RightColumn.Area.Height);
                layout.LeftColumn.Area = new Int32Rect(layout.LeftColumn.Area.X, layout.LeftColumn.Area.Y, combinedWidth - layout.RightColumn.Area.Width, layout.LeftColumn.Area.Height);
            }
        }