Пример #1
0
        /// <summary>Capture current tool layout of specified <paramref name="viewDockService"/>.</summary>
        /// <param name="viewDockService">The tool dock service.</param>
        /// <exception cref="ArgumentNullException"><paramref name="viewDockService"/> == <c>null</c>.</exception>
        public ViewLayout(ViewDockService viewDockService)
        {
            Verify.Argument.IsNotNull(viewDockService, nameof(viewDockService));

            var grid = viewDockService.Grid;

            _root = ToLayout(grid.RootControl);

            if (grid.LeftSide != null)
            {
                _left = new SideEntry(grid.LeftSide);
            }
            if (grid.TopSide != null)
            {
                _top = new SideEntry(grid.TopSide);
            }
            if (grid.RightSide != null)
            {
                _right = new SideEntry(grid.RightSide);
            }
            if (grid.BottomSide != null)
            {
                _bottom = new SideEntry(grid.BottomSide);
            }
            _floats = new List <FloatEntry>();
            foreach (var floatingViewForm in grid.FloatingViewForms)
            {
                _floats.Add(new FloatEntry(floatingViewForm));
            }
        }
Пример #2
0
        /// <summary>Capture current tool layout of specified <paramref name="viewDockService"/>.</summary>
        /// <param name="viewDockService">The tool dock service.</param>
        /// <exception cref="ArgumentNullException"><paramref name="viewDockService"/> == <c>null</c>.</exception>
        public ViewLayout(ViewDockService viewDockService)
        {
            Verify.Argument.IsNotNull(viewDockService, "viewDockService");

            var grid = viewDockService.Grid;

            _root = ToLayout(grid.RootControl);

            if(grid.LeftSide != null)
            {
                _left = new SideEntry(grid.LeftSide);
            }
            if(grid.TopSide != null)
            {
                _top = new SideEntry(grid.TopSide);
            }
            if(grid.RightSide != null)
            {
                _right = new SideEntry(grid.RightSide);
            }
            if(grid.BottomSide != null)
            {
                _bottom = new SideEntry(grid.BottomSide);
            }
            _floats = new List<FloatEntry>();
            foreach(var floatingViewForm in grid.FloatingViewForms)
            {
                _floats.Add(new FloatEntry(floatingViewForm));
            }
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewLayout"/> class.
        /// </summary>
        /// <param name="section">The section.</param>
        public ViewLayout(Section section)
        {
            Verify.Argument.IsNotNull(section, nameof(section));

            _root = ToLayout(section.GetSection("Root"));

            var sides = section.TryGetSection("Sides");

            if (sides != null)
            {
                var left = sides.TryGetSection("Left");
                if (left != null)
                {
                    _left = new SideEntry(AnchorStyles.Left, left);
                }
                var top = sides.TryGetSection("Top");
                if (top != null)
                {
                    _top = new SideEntry(AnchorStyles.Top, top);
                }
                var right = sides.TryGetSection("Right");
                if (right != null)
                {
                    _right = new SideEntry(AnchorStyles.Right, right);
                }
                var bottom = sides.TryGetSection("Bottom");
                if (bottom != null)
                {
                    _bottom = new SideEntry(AnchorStyles.Bottom, bottom);
                }
            }
            var floats = section.TryGetSection("Floats");

            if (floats != null)
            {
                foreach (var f in floats.Sections)
                {
                    _floats.Add(new FloatEntry(f));
                }
            }
        }
Пример #4
0
 public BaseArena(Arkanoid game)
 {
     Game          = game;
     TopLeftEntry  = new TopEntry(Game, new Vector2(Sprites.FrmCorner.Width + Sprites.FrmTopOpen.Width, 0));
     TopRightEntry = new TopEntry(Game,
                                  new Vector2(
                                      Game.FrameArea.Width - (Sprites.FrmCorner.Width + Sprites.FrmTopOpen.Width * 2),
                                      0));
     SideLeftTopEntry = new SideEntry(Game, new Vector2(0, Sprites.FrmCorner.Height), false);
     SideLeftMidEntry = new SideEntry(Game,
                                      new Vector2(0,
                                                  Game.FrameArea.Height / 2f - Sprites.FrmSideWarp.Height / 2), false);
     SideRightTopEntry = new SideEntry(Game,
                                       new Vector2(Game.FrameArea.Width - Sprites.FrmSideOpen.Width,
                                                   Sprites.FrmCorner.Height), true);
     SideRightMidEntry = new SideEntry(Game,
                                       new Vector2(Game.FrameArea.Width - Sprites.FrmSideOpen.Width,
                                                   Game.FrameArea.Height / 2f - Sprites.FrmSideWarp.Height / 2), true);
     LeftWarp  = new Warp(new Vector2(0, Game.FrameArea.Height - Sprites.FrmSideWarp.Height * 2), false);
     RightWarp = new Warp(new Vector2(Game.FrameArea.Width - Sprites.FrmSideWarp.Width,
                                      Game.FrameArea.Height - Sprites.FrmSideWarp.Height * 2), true);
     Fade = new Fader(true, true);
 }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewLayout"/> class.
        /// </summary>
        /// <param name="section">The section.</param>
        public ViewLayout(Section section)
        {
            Verify.Argument.IsNotNull(section, "section");

            _root = ToLayout(section.GetSection("Root"));

            var sides = section.TryGetSection("Sides");
            if(sides != null)
            {
                var left = sides.TryGetSection("Left");
                if(left != null)
                {
                    _left = new SideEntry(AnchorStyles.Left, left);
                }
                var top = sides.TryGetSection("Top");
                if(top != null)
                {
                    _top = new SideEntry(AnchorStyles.Top, top);
                }
                var right = sides.TryGetSection("Right");
                if(right != null)
                {
                    _right = new SideEntry(AnchorStyles.Right, right);
                }
                var bottom = sides.TryGetSection("Bottom");
                if(bottom != null)
                {
                    _bottom = new SideEntry(AnchorStyles.Bottom, bottom);
                }
            }
            var floats = section.TryGetSection("Floats");
            if(floats != null)
            {
                foreach(var f in floats.Sections)
                {
                    _floats.Add(new FloatEntry(f));
                }
            }
        }