예제 #1
0
        protected void MoveWindowBackInScreen()
        {
            if (MoveIn != null)
            {
                MoveIn(this, EventArgs.Empty);
            }
            double newleft;

            if (_movedoutside == Side.Left)
            {
                newleft = WpfScreen.MostLeftX;
            }
            else
            {
                newleft = WpfScreen.MostRightX - BaseWindow.Width;
            }
            BaseWindow.Left = _movedoutside == Side.Left ? newleft + 10 : newleft - 10;

            Storyboard      moveWindowBackInScreenStoryboard = new Storyboard();
            DoubleAnimation inanimation = new DoubleAnimation(BaseWindow.Left, newleft, TimeSpan.FromMilliseconds(150), FillBehavior.Stop);

            inanimation.Completed += (s, e) => { BaseWindow.Topmost = false; BaseWindow.Left = newleft; };
            moveWindowBackInScreenStoryboard.Children.Add(inanimation);
            Storyboard.SetTargetName(inanimation, BaseWindow.Name);
            Storyboard.SetTargetProperty(moveWindowBackInScreenStoryboard, new PropertyPath(Window.LeftProperty));

            moveWindowBackInScreenStoryboard.Begin(BaseWindow);

            MovedOut           = false;
            BaseWindow.Topmost = true;
            BaseWindow.Activate();
            BaseWindow.ShowInTaskbar = true;

            StopMagic();
        }
예제 #2
0
        private void MoveWindowBackInScreen()
        {
            MoveIn?.Invoke(this, EventArgs.Empty);
            double newleft;

            if (_movedOutSide == Side.Left)
            {
                newleft = WpfScreen.MostLeftX;
            }
            else
            {
                newleft = WpfScreen.MostRightX - BaseWindow.Width;
            }
            BaseWindow.Left = _movedOutSide == Side.Left ? newleft + 10 : newleft - 10;

            var animation = new DoubleAnimation(BaseWindow.Left, newleft, TimeSpan.FromMilliseconds(150),
                                                FillBehavior.Stop)
            {
                EasingFunction = new CircleEase()
            };

            animation.Completed += (s, e) => { BaseWindow.Topmost = false; BaseWindow.Left = newleft; };
            BaseWindow.BeginAnimation(Window.LeftProperty, animation);

            _movedOut          = false;
            BaseWindow.Topmost = true;
            BaseWindow.Activate();
            BaseWindow.ShowInTaskbar = true;

            StopMagic();
        }