예제 #1
0
        /// <summary>
        /// 显示窗口动画
        /// </summary>
        private void AnimationShow(CompletedActionType completedAction)
        {
            if (IsAnimation && WindowAnimationType != AnimationType.None)
            {
                if ((RenderTransform as TransformGroup).Children.Count == 0)
                {
                    CreateWindowOpenAnimation();
                    CreateWindowCloseAnimation();
                }
                CompletedAction(completedAction);
                switch (WindowAnimationType)
                {
                case AnimationType.RightBottomScale:
                case AnimationType.Cool:
                    Opacity = 1;
                    openWindowStoryboard.Begin();
                    break;

                default:
                    openWindowStoryboard.Begin();
                    break;
                }
            }
            else
            {
                if ((RenderTransform as TransformGroup).Children.Count != 0)
                {
                    (RenderTransform as TransformGroup).Children.Clear();
                }
                Opacity = 1;
                CompletedAction(completedAction);
            }
            OnWShow?.Invoke(this, null);
        }
예제 #2
0
        private void CompletedAction(CompletedActionType completedAction)
        {
            switch (completedAction)
            {
            case CompletedActionType.Close:
                Close();
                break;

            case CompletedActionType.Hide:
                Hide();
                break;

            case CompletedActionType.Show:
                //如果开启了鼠标穿透则不抢占焦点
                ShowActivated = !IsThruWindow;
                Show();
                break;
            }
        }
예제 #3
0
        /// <summary>
        /// 隐藏窗口动画
        /// </summary>
        private void AnimationHide(CompletedActionType completedAction)
        {
            if (IsAnimation && WindowAnimationType != AnimationType.None)
            {
                if ((RenderTransform as TransformGroup).Children.Count == 0)
                {
                    CreateWindowOpenAnimation();
                    CreateWindowCloseAnimation();
                }
                switch (WindowAnimationType)
                {
                case AnimationType.None:
                    CompletedAction(completedAction);
                    OnWHide?.Invoke(this, null);

                    break;

                case AnimationType.RightBottomScale:
                case AnimationType.Opacity:
                case AnimationType.Cool:
                    closeWindowStoryboard.Completed += (e, c) =>
                    {
                        Opacity = 0;
                        CompletedAction(completedAction);
                        OnWHide?.Invoke(this, null);
                    };
                    closeWindowStoryboard.Begin();
                    break;
                }
            }
            else
            {
                if ((RenderTransform as TransformGroup).Children.Count != 0)
                {
                    (RenderTransform as TransformGroup).Children.Clear();
                }
                Opacity = 0;
                CompletedAction(completedAction);
                OnWHide?.Invoke(this, null);
            }
        }