예제 #1
0
 private List <RenderedZone> RenderZones(Layout layoutBase, ScreenInfo.DisplayInfoCollection displayinfo = null)
 {
     displayinfo = displayinfo ?? ScreenInfo.GetDisplays();
     return(layoutBase.List.SelectMany <IRenderableZoneBase <IRenderableBound, IRenderableBound, IRenderableBound, IRenderableBound>, RenderedZone>(zone =>
                                                                                                                                                    //If layout is duplicated, create layout once per each monitor using said monitors bounds
                                                                                                                                                    (zone.Layout == LayoutKind.Duplicated ? displayinfo.Select(y => zone.Render(
                                                                                                                                                                                                                   DI: displayinfo,
                                                                                                                                                                                                                   x: y.WorkArea.Left,
                                                                                                                                                                                                                   y: y.WorkArea.Top,
                                                                                                                                                                                                                   LayoutWidth: y.WorkArea.Right - y.WorkArea.Left,
                                                                                                                                                                                                                   LayoutHeight: y.WorkArea.Bottom - y.WorkArea.Top
                                                                                                                                                                                                                   )).OfType <RenderedZone>() :
                                                                                                                                                     //If layout is spanning, create layout once using full work area bounds
                                                                                                                                                     zone.Layout == LayoutKind.Spanning ? new RenderedZone[] { zone.Render(
                                                                                                                                                                                                                   DI: displayinfo,
                                                                                                                                                                                                                   x: displayinfo.Min(y => y.WorkArea.Left),
                                                                                                                                                                                                                   y: displayinfo.Min(y => y.WorkArea.Top),
                                                                                                                                                                                                                   LayoutWidth: displayinfo.MaxWidth - displayinfo.Min(y => y.WorkArea.Left),
                                                                                                                                                                                                                   LayoutHeight: displayinfo.MaxHeight - displayinfo.Min(y => y.WorkArea.Top)
                                                                                                                                                                                                                   ) }.OfType <RenderedZone>() :
                                                                                                                                                     //If layout is selected screans, create layout once per selected monitor, using said monitors bounds
                                                                                                                                                     zone.Layout == LayoutKind.SelectedScreens ? zone.ScreenIndexes
                                                                                                                                                     .Where(x => x < displayinfo.Count())
                                                                                                                                                     .Select(x => displayinfo[x])
                                                                                                                                                     .Select(y => zone.Render(
                                                                                                                                                                 DI: displayinfo,
                                                                                                                                                                 x: y.WorkArea.Left,
                                                                                                                                                                 y: y.WorkArea.Top,
                                                                                                                                                                 LayoutWidth: y.WorkArea.Right - y.WorkArea.Left,
                                                                                                                                                                 LayoutHeight: y.WorkArea.Bottom - y.WorkArea.Top
                                                                                                                                                                 )).OfType <RenderedZone>() :
                                                                                                                                                     throw new Exception("Unknown layout kind (how did you even do that with an enum?"))
                                                                                                                                                    ).ToList());
 }
예제 #2
0
        public RenderedLayout(Layout layoutBase, ScreenInfo.DisplayInfoCollection displayinfo = null, Layout Parent = null)
        {
            Base = layoutBase;

            var parentZones = Parent?.Render(displayinfo).Zones;

            Zones = parentZones?.Union(RenderZones(layoutBase, displayinfo)).ToList() ?? RenderZones(layoutBase, displayinfo);
        }
예제 #3
0
 public Bounds <int, int, int, int> RenderBounds(ScreenInfo.DisplayInfoCollection DI, int x, int y, int LayoutWidth, int LayoutHeight)
 {
     return(new Bounds <int, int, int, int>
     {
         Top = Top.RenderBound(DI, RectangleSide.Top, y, LayoutHeight),          //(int)(LayoutHeight * Top.Decimal) + y,
         Bottom = Bottom.RenderBound(DI, RectangleSide.Bottom, y, LayoutHeight), //(int)(LayoutHeight * Bottom.Decimal) + y,
         Left = Left.RenderBound(DI, RectangleSide.Left, x, LayoutWidth),        //(int)(LayoutWidth * Left.Decimal) + x,
         Right = Right.RenderBound(DI, RectangleSide.Right, x, LayoutWidth),     //(int)(LayoutWidth * Right.Decimal) + x,
     });
 }
예제 #4
0
        public int RenderBound(ScreenInfo.DisplayInfoCollection DI, RectangleSide Side, int Offset, int Dimension)
        {
            var display = DI[Value];

            switch (Side)
            {
            case RectangleSide.Left:
                return(display.WorkArea.Left);

            case RectangleSide.Top:
                return(display.WorkArea.Top);

            case RectangleSide.Right:
                return(display.WorkArea.Right);

            case RectangleSide.Bottom:
                return(display.WorkArea.Bottom);
            }
            return(0);
        }
예제 #5
0
 public RenderedLayout Render(ScreenInfo.DisplayInfoCollection di = null, Layout Parent = null) => new RenderedLayout(this, di, Parent);
예제 #6
0
 public int RenderBound(ScreenInfo.DisplayInfoCollection DI, RectangleSide Side, int Offset, int Dimension)
 {
     return((int)(Dimension * Decimal) + Offset);
 }