示例#1
0
        public void Remove()
        {
            if (this.Children == null)
            {
                return;
            }

            if (this.Children.Count == 0)
            {
                return;
            }

            var element = this.Children[this.Children.Count - 1];

            Action compate = () =>
            {
                this.Children.Remove(element);

                if (this.Children.Count == 0)
                {
                    DoubleStoryboardEngine.Create(1, 0, 0.3, "Opacity").Start(this, l => l.Visibility = Visibility.Collapsed);
                }
            };

            this.AnimationAction?.BeginPrevious(element, compate);
        }
        private void MinCommand_Execute(object sender, ExecutedRoutedEventArgs e)
        {
            //this.WindowState = WindowState.Minimized;
            //e.Handled = true;

            //  Do :当点击任务栏,最小化时发生
            var engine = DoubleStoryboardEngine.Create(this.Top, this.Top + 200, 0.2, Window.TopProperty.Name);

            engine.CompletedEvent += (l, k) => this.WindowState = WindowState.Minimized;
            DoubleStoryboardEngine.Create(1, 0, 0.3, UIElement.OpacityProperty.Name).Start(this);
            engine.Start(this);
            e.Handled = true;
        }
示例#3
0
        public void Add(UIElement element)
        {
            this.Children.Add(element);

            this.AnimationAction?.BeginCurrent(element);

            if (this.Children.Count == 1)
            {
                this.Visibility = Visibility.Visible;

                DoubleStoryboardEngine.Create(0, 1, 0.3, "Opacity").Start(this);
            }
        }
        public LoginWindowBase()
        {
            this.ShowAnimation = l =>
            {
                l.RenderTransformOrigin = new Point(0.5, 0.5);

                var engine2 = DoubleStoryboardEngine.Create(0.5, 1, 0.5, "Opacity");
                var engine  = DoubleStoryboardEngine.Create(0.1, 0.98, 1, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)");
                var engine1 = DoubleStoryboardEngine.Create(0.1, 0.98, 1, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)");

                engine.Start(l);
                engine1.Start(l);
                engine2.Start(l);
            };
        }
示例#5
0
        public StartWindowBase()
        {
            this.ShowAnimation = l =>
            {
                l.RenderTransformOrigin = new Point(0.5, 0.5);

                var engine2 = DoubleStoryboardEngine.Create(0.5, 1, 0.5, UIElement.OpacityProperty.Name);
                var engine  = DoubleStoryboardEngine.Create(0.1, 0.96, 0.3, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)");
                var engine1 = DoubleStoryboardEngine.Create(0.1, 0.96, 0.3, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)");

                engine.Start(l);
                engine1.Start(l);
                engine2.Start(l);


                //l.ScaleEnlarge(new Point(0.5, 0.5), 0.5, 5);
            };

            this.CloseAnimation = l =>
            {
                l.RenderTransformOrigin = new Point(0.5, 0.5);

                var engine2 = DoubleStoryboardEngine.Create(1, 0.5, 0.3, "Opacity");
                var engine  = DoubleStoryboardEngine.Create(1, 0.1, 0.3, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)");
                var engine1 = DoubleStoryboardEngine.Create(1, 0.1, 0.3, "(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)");

                engine.CompletedEvent += (s, e) =>
                {
                    this.MouseDown -= DialogWindow_MouseDown;
                    l.Close();
                };

                engine.Start(l);
                engine1.Start(l);
                engine2.Start(l);
            };

            this.BindCommand(CommandService.Close, (l, k) =>
            {
                this.CloseAnimation?.Invoke(this);
            });

            this.MouseDown += DialogWindow_MouseDown;
        }
        public NotifyWindow()
        {
            this.ShowAnimation = l =>
            {
                var engine = DoubleStoryboardEngine.Create(this.Height, 0, 0.5, "(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)");
                engine.Start(l);
            };

            this.CloseAnimation = l =>
            {
                l.RenderTransformOrigin = new Point(0.5, 0.5);

                var engine = DoubleStoryboardEngine.Create(0, this.Height, 0.5, "(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)");

                engine.CompletedEvent += (s, e) =>
                {
                    l.Close();
                };
                engine.Start(l);
            };

            this.BindCommand(CommandService.Close, (l, k) =>
            {
                this.CloseAnimation?.Invoke(this);
            });

            this.WindowStartupLocation = WindowStartupLocation.Manual;



            this.Loaded += (l, k) =>
            {
                double screeHeight = SystemParameters.WorkArea.Height;

                double screeWidth = SystemParameters.WorkArea.Width;

                this.Top = screeHeight - this.Height - 2;

                this.Left = screeWidth - this.Width - 5;
            };
        }
        /// <summary> 执行动画 </summary>
        public static void BegionDoubleStoryBoard(this UIElement element, double start, double end, double duration, string propertyName)
        {
            var engine = DoubleStoryboardEngine.Create(start, end, duration, propertyName);

            engine.Start(element);
        }
示例#8
0
        /// <summary> 执行动画 </summary>
        public static void BegionDoubleStoryBoard(this UIElement element, double start, double end, double duration, string propertyName, Action <UIElement> Completed = null, Action <Storyboard> init = null)
        {
            var engine = DoubleStoryboardEngine.Create(start, end, duration, propertyName);

            engine.Start(element, Completed, init);
        }