Exemple #1
0
        protected void UpdateChildLocation()
        {
            if (SkipArrange || Child == null || !Child.IsInitialized || IsArrangeValid)
            {
                return;
            }
            if (arrangeMode == SplashScreenArrangeMode.ArrangeOnStartupOnly && lastParentPos != Rect.Empty && lastParentPos != nextParentPos)
            {
                arrangeMode = SplashScreenArrangeMode.Skip;
                return;
            }
            Rect bounds = nextParentPos;
            var  window = Child.Window;

            if (!IsZero(window.ActualWidth) && !IsZero(window.ActualHeight))
            {
                if (childLocation == SplashScreenLocation.CenterScreen)
                {
                    bounds = GetDpiBasedBounds(bounds, window);
                }
                var newPosition = new Point(bounds.X + (bounds.Width - window.ActualWidth) * 0.5, bounds.Y + (bounds.Height - window.ActualHeight) * 0.5);
                window.Left   = Math.Round(newPosition.X);
                window.Top    = Math.Round(newPosition.Y);
                lastChildPos  = new Rect(window.Left, window.Top, window.Width, window.Height);
                lastParentPos = bounds;
            }
        }
        void UpdateChildPosition()
        {
            if (SkipArrange || Child == null || !Child.IsInitialized || IsArrangeValid)
            {
                return;
            }
            if (arrangeMode == SplashScreenArrangeMode.ArrangeOnStartupOnly && lastParentPos != Rect.Empty && lastParentPos != nextParentPos)
            {
                arrangeMode = SplashScreenArrangeMode.Skip;
                return;
            }
            Rect bounds = nextParentPos;
            var  window = Child.Window;

            if (!IsZero(window.ActualWidth) && !IsZero(window.ActualHeight))
            {
                window.Left  = (int)(bounds.X + (bounds.Width - window.ActualWidth) * 0.5);
                window.Top   = (int)(bounds.Y + (bounds.Height - window.ActualHeight) * 0.5);
                lastChildPos = new Rect(window.Left, window.Top, window.Width, window.Height);
            }
            lastParentPos = bounds;
        }
Exemple #3
0
 protected internal WindowArrangerBase(WindowArrangerContainer parent, SplashScreenLocation childLocation, SplashScreenArrangeMode arrangeMode)
 {
     this.childLocation = childLocation;
     this.arrangeMode   = arrangeMode;
     AttachParent(parent);
 }
Exemple #4
0
 protected internal WindowArranger(WindowArrangerContainer parent, SplashScreenLocation childLocation, SplashScreenArrangeMode arrangeMode)
     : base(parent, childLocation, arrangeMode)
 {
 }