Пример #1
0
        private void ActivateFrame(int selectedIndex, int unselectedIndex)
        {
            if (!IsLoaded)
            {
                return;
            }

            TransitionerSlide oldSlide = null, newSlide = null;

            for (var index = 0; index < Items.Count; index++)
            {
                var slide = GetSlide(Items[index]);
                if (index == selectedIndex)
                {
                    newSlide = slide;
                    slide.SetCurrentValue(TransitionerSlide.StateProperty, TransitionerSlideState.Current);
                }
                else if (index == unselectedIndex)
                {
                    oldSlide = slide;
                    slide.SetCurrentValue(TransitionerSlide.StateProperty, TransitionerSlideState.Previous);
                }
                else
                {
                    slide.SetCurrentValue(TransitionerSlide.StateProperty, TransitionerSlideState.None);
                }
                Panel.SetZIndex(slide, 0);
            }

            if (newSlide != null)
            {
                newSlide.Opacity = 1;
            }

            if (oldSlide != null && newSlide != null)
            {
                var wipe = selectedIndex > unselectedIndex ? oldSlide.ForwardWipe : oldSlide.BackwardWipe;
                if (wipe != null)
                {
                    wipe.Wipe(oldSlide, newSlide, GetTransitionOrigin(newSlide), this);
                }
                else
                {
                    DoStack(newSlide, oldSlide);
                }

                oldSlide.Opacity = 0;
            }
            else if (oldSlide != null || newSlide != null)
            {
                DoStack(oldSlide ?? newSlide);
                if (oldSlide != null)
                {
                    oldSlide.Opacity = 0;
                }
            }

            _nextTransitionOrigin = null;
        }
Пример #2
0
        public void Wipe(TransitionerSlide fromSlide, TransitionerSlide toSlide, Point origin, IZIndexController zIndexController)
        {
            if (fromSlide == null)
            {
                throw new ArgumentNullException(nameof(fromSlide));
            }
            if (toSlide == null)
            {
                throw new ArgumentNullException(nameof(toSlide));
            }
            if (zIndexController == null)
            {
                throw new ArgumentNullException(nameof(zIndexController));
            }

            // Set up time points
            var zeroKeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);
            var endKeyTime  = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(Duration.TotalSeconds / 2));

            // From
            var fromAnimation = new DoubleAnimationUsingKeyFrames();

            fromAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(1, zeroKeyTime));
            fromAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime, _sineEase));

            // To
            var toAnimation = new DoubleAnimationUsingKeyFrames();

            toAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(0, zeroKeyTime));
            toAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, endKeyTime, _sineEase));

            // Preset
            fromSlide.Opacity = 1;
            toSlide.Opacity   = 0;

            // Set up events
            toAnimation.Completed += (sender, args) =>
            {
                toSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
                toSlide.Opacity   = 1;
            };
            fromAnimation.Completed += (sender, args) =>
            {
                fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
                toSlide.BeginAnimation(UIElement.OpacityProperty, toAnimation);
            };

            // Animate
            fromSlide.BeginAnimation(UIElement.OpacityProperty, fromAnimation);
            zIndexController.Stack(toSlide, fromSlide);
        }
        public void Wipe(TransitionerSlide fromSlide, TransitionerSlide toSlide, Point origin, IZIndexController zIndexController)
        {
            if (fromSlide == null) throw new ArgumentNullException(nameof(fromSlide));
            if (toSlide == null) throw new ArgumentNullException(nameof(toSlide));
            if (zIndexController == null) throw new ArgumentNullException(nameof(zIndexController));

            var horizontalProportion = Math.Max(1.0 - origin.X, 1.0 * origin.X);
            var verticalProportion = Math.Max(1.0 - origin.Y, 1.0 * origin.Y);
            var radius = Math.Sqrt(Math.Pow(toSlide.ActualWidth * horizontalProportion, 2) + Math.Pow(toSlide.ActualHeight * verticalProportion, 2));

            var scaleTransform = new ScaleTransform(0, 0);
            var translateTransform = new TranslateTransform(toSlide.ActualWidth * origin.X, toSlide.ActualHeight * origin.Y);
            var transformGroup = new TransformGroup();
            transformGroup.Children.Add(scaleTransform);
            transformGroup.Children.Add(translateTransform);
            var ellipseGeomotry = new EllipseGeometry()
            {
                RadiusX = radius,
                RadiusY = radius,
                Transform = transformGroup
            };
            
            toSlide.SetCurrentValue(UIElement.ClipProperty, ellipseGeomotry);            
            zIndexController.Stack(toSlide, fromSlide);

            var zeroKeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);
            var midKeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200));
            var endKeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400));

            var opacityAnimation = new DoubleAnimationUsingKeyFrames();
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, zeroKeyTime));
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, midKeyTime));
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime));
            opacityAnimation.Completed += (sender, args) =>
            {
                fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
            };
            fromSlide.BeginAnimation(UIElement.OpacityProperty, opacityAnimation);

            var scaleAnimation = new DoubleAnimationUsingKeyFrames();
            scaleAnimation.Completed  += (sender, args) =>
            {
                toSlide.SetCurrentValue(UIElement.ClipProperty, null);
                fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
            };
            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, zeroKeyTime));
            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, endKeyTime));
            scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation);
            scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation);
        }
Пример #4
0
        private Point GetTransitionOrigin(TransitionerSlide slide)
        {
            if (_nextTransitionOrigin != null)
            {
                return(_nextTransitionOrigin.Value);
            }

            if (slide.ReadLocalValue(TransitionerSlide.TransitionOriginProperty) != DependencyProperty.UnsetValue)
            {
                return(slide.TransitionOrigin);
            }

            return(DefaultTransitionOrigin);
        }
        public void Wipe(TransitionerSlide fromSlide, TransitionerSlide toSlide, Point origin, IZIndexController zIndexController)
        {
            if (fromSlide == null) throw new ArgumentNullException(nameof(fromSlide));
            if (toSlide == null) throw new ArgumentNullException(nameof(toSlide));
            if (zIndexController == null) throw new ArgumentNullException(nameof(zIndexController));

            var zeroKeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);
            var midishKeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200));
            var endKeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400));

            //back out old slide setup
            var scaleTransform = new ScaleTransform(1, 1);
            fromSlide.RenderTransform = scaleTransform;
            var scaleAnimation = new DoubleAnimationUsingKeyFrames();
            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, zeroKeyTime));
            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(.8, endKeyTime));
            scaleAnimation.Completed += (sender, args) =>
            {
                fromSlide.RenderTransform = null;                             
            };
            var opacityAnimation = new DoubleAnimationUsingKeyFrames();
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, zeroKeyTime));
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime));
            opacityAnimation.Completed += (sender, args) =>
            {
                fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
            };

            //slide in new slide setup
            var translateTransform = new TranslateTransform(0, toSlide.ActualHeight);
            toSlide.RenderTransform = translateTransform;            
            var slideAnimation = new DoubleAnimationUsingKeyFrames();
            slideAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(toSlide.ActualHeight, zeroKeyTime));
            slideAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(toSlide.ActualHeight, midishKeyTime) { EasingFunction = _sineEase});
            slideAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime) { EasingFunction = _sineEase });

            //kick off!
            translateTransform.BeginAnimation(TranslateTransform.YProperty, slideAnimation);
            scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation);            
            scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation);
            fromSlide.BeginAnimation(UIElement.OpacityProperty, opacityAnimation);

            zIndexController.Stack(toSlide, fromSlide);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MainForm = ((SystemMed.MainWindow)(target));

            #line 10 "..\..\MainWindow.xaml"
                this.MainForm.Activated += new System.EventHandler(this.MainForm_Activated);

            #line default
            #line hidden
                return;

            case 2:
                this.CloseMenu_BeginStoryboard = ((System.Windows.Media.Animation.BeginStoryboard)(target));
                return;

            case 3:
                this.StackPanelMenu = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 4:
                this.button = ((System.Windows.Controls.Button)(target));
                return;

            case 5:
                this.listViewItem = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 6:
                this.listViewItem1 = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 7:
                this.menuItemConsultationList1 = ((System.Windows.Controls.TextBlock)(target));

            #line 176 "..\..\MainWindow.xaml"
                this.menuItemConsultationList1.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.menuItemConsultationList_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.listViewItem2 = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 9:
                this.menuItemDiagnosesList1 = ((System.Windows.Controls.TextBlock)(target));

            #line 194 "..\..\MainWindow.xaml"
                this.menuItemDiagnosesList1.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.menuItemDiagnosesList_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.listViewItem3 = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 11:
                this.menuItemDoctorsList1 = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 12:

            #line 208 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.TextBlock)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.menuItemDoctorsList_Click);

            #line default
            #line hidden
                return;

            case 13:
                this.listViewItem7 = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 14:
                this.menuItemPatientList = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 15:

            #line 222 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.TextBlock)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.menuItemDoctorsList_Click);

            #line default
            #line hidden
                return;

            case 16:
                this.listViewItem4 = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 17:
                this.menuItemUserRegistration1 = ((System.Windows.Controls.TextBlock)(target));

            #line 236 "..\..\MainWindow.xaml"
                this.menuItemUserRegistration1.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.menuItemUserRegistration_Click);

            #line default
            #line hidden
                return;

            case 18:
                this.listViewItem5 = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 19:

            #line 250 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.TextBlock)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.menuItemLogin_Click);

            #line default
            #line hidden
                return;

            case 20:
                this.listViewItem6 = ((System.Windows.Controls.ListViewItem)(target));
                return;

            case 21:

            #line 264 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.TextBlock)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.menuItemExit_Click);

            #line default
            #line hidden
                return;

            case 22:
                this.GridMain = ((System.Windows.Controls.Grid)(target));
                return;

            case 23:
                this.TransitionerSlide = ((MaterialDesignThemes.Wpf.Transitions.TransitionerSlide)(target));
                return;

            case 24:
                this.menuItemFile = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 25:
                this.menuItemExit = ((System.Windows.Controls.MenuItem)(target));

            #line 332 "..\..\MainWindow.xaml"
                this.menuItemExit.Click += new System.Windows.RoutedEventHandler(this.menuItemExit_Click);

            #line default
            #line hidden
                return;

            case 26:
                this.menuItemConsultations = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 27:
                this.menuItemConsultationList = ((System.Windows.Controls.MenuItem)(target));

            #line 335 "..\..\MainWindow.xaml"
                this.menuItemConsultationList.Click += new System.Windows.RoutedEventHandler(this.menuItemConsultationList_Click);

            #line default
            #line hidden
                return;

            case 28:
                this.menuItemNewConsultation = ((System.Windows.Controls.MenuItem)(target));

            #line 336 "..\..\MainWindow.xaml"
                this.menuItemNewConsultation.Click += new System.Windows.RoutedEventHandler(this.menuItemNewConsultation_Click);

            #line default
            #line hidden
                return;

            case 29:
                this.menuItemDiagnoses = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 30:
                this.menuItemDiagnosesList = ((System.Windows.Controls.MenuItem)(target));

            #line 339 "..\..\MainWindow.xaml"
                this.menuItemDiagnosesList.Click += new System.Windows.RoutedEventHandler(this.menuItemDiagnosesList_Click);

            #line default
            #line hidden
                return;

            case 31:
                this.menuItemNewDiagnose = ((System.Windows.Controls.MenuItem)(target));

            #line 340 "..\..\MainWindow.xaml"
                this.menuItemNewDiagnose.Click += new System.Windows.RoutedEventHandler(this.menuItemNewDiagnose_Click);

            #line default
            #line hidden
                return;

            case 32:
                this.menuItemDoctors = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 33:
                this.menuItemDoctorsList = ((System.Windows.Controls.MenuItem)(target));

            #line 343 "..\..\MainWindow.xaml"
                this.menuItemDoctorsList.Click += new System.Windows.RoutedEventHandler(this.menuItemDoctorsList_Click);

            #line default
            #line hidden
                return;

            case 34:
                this.menuItemNewDoctor = ((System.Windows.Controls.MenuItem)(target));

            #line 344 "..\..\MainWindow.xaml"
                this.menuItemNewDoctor.Click += new System.Windows.RoutedEventHandler(this.menuItemNewDoctor_Click);

            #line default
            #line hidden
                return;

            case 35:
                this.menuItemUser = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 36:
                this.menuItemUserProfile = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 37:
                this.menuItemCurrentDoctor = ((System.Windows.Controls.MenuItem)(target));

            #line 348 "..\..\MainWindow.xaml"
                this.menuItemCurrentDoctor.Click += new System.Windows.RoutedEventHandler(this.menuItemCurrentDoctor_Click);

            #line default
            #line hidden
                return;

            case 38:
                this.menuItemCurrentPatient = ((System.Windows.Controls.MenuItem)(target));

            #line 349 "..\..\MainWindow.xaml"
                this.menuItemCurrentPatient.Click += new System.Windows.RoutedEventHandler(this.menuItemCurrentPatient_Click);

            #line default
            #line hidden
                return;

            case 39:
                this.userToolStripMenuItem = ((System.Windows.Controls.MenuItem)(target));

            #line 350 "..\..\MainWindow.xaml"
                this.userToolStripMenuItem.Click += new System.Windows.RoutedEventHandler(this.userToolStripMenuItem_Click);

            #line default
            #line hidden
                return;

            case 40:
                this.menuItemUserRegistration = ((System.Windows.Controls.MenuItem)(target));

            #line 352 "..\..\MainWindow.xaml"
                this.menuItemUserRegistration.Click += new System.Windows.RoutedEventHandler(this.menuItemUserRegistration_Click);

            #line default
            #line hidden
                return;

            case 41:
                this.menuItemLogin = ((System.Windows.Controls.MenuItem)(target));

            #line 353 "..\..\MainWindow.xaml"
                this.menuItemLogin.Click += new System.Windows.RoutedEventHandler(this.menuItemLogin_Click);

            #line default
            #line hidden
                return;

            case 42:
                this.menuItemAdmin = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 43:
                this.menuItemUsersList = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 44:
                this.menuItemPatients = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 45:
                this.menuItemPatientsList = ((System.Windows.Controls.MenuItem)(target));

            #line 359 "..\..\MainWindow.xaml"
                this.menuItemPatientsList.Click += new System.Windows.RoutedEventHandler(this.menuItemPatientsList_Click);

            #line default
            #line hidden
                return;

            case 46:
                this.menuItemNewPatient = ((System.Windows.Controls.MenuItem)(target));

            #line 360 "..\..\MainWindow.xaml"
                this.menuItemNewPatient.Click += new System.Windows.RoutedEventHandler(this.menuItemNewPatient_Click);

            #line default
            #line hidden
                return;

            case 47:
                this.Kardoc = ((System.Windows.Controls.Image)(target));
                return;

            case 48:
                this.Karadm = ((System.Windows.Controls.Image)(target));
                return;

            case 49:
                this.labelStatusUser = ((System.Windows.Controls.Primitives.StatusBarItem)(target));
                return;

            case 50:
                this.labelStatusLoggedUser = ((System.Windows.Controls.Primitives.StatusBarItem)(target));
                return;

            case 51:
                this.labelStatusNextConsultations = ((System.Windows.Controls.Primitives.StatusBarItem)(target));

            #line 377 "..\..\MainWindow.xaml"
                this.labelStatusNextConsultations.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.labelStatusNextConsultations_Click);

            #line default
            #line hidden
                return;

            case 52:
                this.labelStatusLoggedUserAnanim = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 53:
                this.labelStatusLoggedUserPatient = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 54:
                this.buttonNewConsultaton = ((System.Windows.Controls.Button)(target));

            #line 399 "..\..\MainWindow.xaml"
                this.buttonNewConsultaton.Click += new System.Windows.RoutedEventHandler(this.menuItemNewConsultation_Click);

            #line default
            #line hidden
                return;

            case 55:
                this.buttonNewDiagnose = ((System.Windows.Controls.Button)(target));

            #line 442 "..\..\MainWindow.xaml"
                this.buttonNewDiagnose.Click += new System.Windows.RoutedEventHandler(this.menuItemNewDiagnose_Click);

            #line default
            #line hidden
                return;

            case 56:
                this.buttonNewPatient = ((System.Windows.Controls.Button)(target));

            #line 475 "..\..\MainWindow.xaml"
                this.buttonNewPatient.Click += new System.Windows.RoutedEventHandler(this.menuItemUserRegistration_Click);

            #line default
            #line hidden
                return;

            case 57:
                this.buttonSpisPatient = ((System.Windows.Controls.Button)(target));

            #line 507 "..\..\MainWindow.xaml"
                this.buttonSpisPatient.Click += new System.Windows.RoutedEventHandler(this.menuItemPatientsList_Click);

            #line default
            #line hidden
                return;

            case 58:
                this.buttonNewDoc = ((System.Windows.Controls.Button)(target));

            #line 539 "..\..\MainWindow.xaml"
                this.buttonNewDoc.Click += new System.Windows.RoutedEventHandler(this.menuItemNewDoctor_Click);

            #line default
            #line hidden
                return;

            case 59:
                this.buttonSpisDoc = ((System.Windows.Controls.Button)(target));

            #line 571 "..\..\MainWindow.xaml"
                this.buttonSpisDoc.Click += new System.Windows.RoutedEventHandler(this.menuItemDoctorsList_Click);

            #line default
            #line hidden
                return;

            case 60:
                this.buttonDiagnoses = ((System.Windows.Controls.Button)(target));

            #line 603 "..\..\MainWindow.xaml"
                this.buttonDiagnoses.Click += new System.Windows.RoutedEventHandler(this.menuItemDiagnosesList_Click);

            #line default
            #line hidden
                return;

            case 61:
                this.buttonConsultations = ((System.Windows.Controls.Button)(target));

            #line 604 "..\..\MainWindow.xaml"
                this.buttonConsultations.Click += new System.Windows.RoutedEventHandler(this.menuItemConsultationList_Click);

            #line default
            #line hidden
                return;

            case 62:
                this.GridbuttonCurrentPatient = ((System.Windows.Controls.Grid)(target));
                return;

            case 63:
                this.buttonCurrentPatient = ((System.Windows.Controls.Button)(target));

            #line 613 "..\..\MainWindow.xaml"
                this.buttonCurrentPatient.Click += new System.Windows.RoutedEventHandler(this.menuItemCurrentPatient_Click);

            #line default
            #line hidden
                return;

            case 64:
                this.buttonExit = ((System.Windows.Controls.Button)(target));

            #line 640 "..\..\MainWindow.xaml"
                this.buttonExit.Click += new System.Windows.RoutedEventHandler(this.menuItemExit_Click);

            #line default
            #line hidden
                return;

            case 65:
                this.labelStatusLoggedUser1 = ((System.Windows.Controls.Label)(target));
                return;

            case 66:
                this.ButtonCloseMenu = ((System.Windows.Controls.Button)(target));

            #line 671 "..\..\MainWindow.xaml"
                this.ButtonCloseMenu.Click += new System.Windows.RoutedEventHandler(this.ButtonCloseMenu_Click);

            #line default
            #line hidden
                return;

            case 67:
                this.ButtonOpenMenu = ((System.Windows.Controls.Button)(target));

            #line 674 "..\..\MainWindow.xaml"
                this.ButtonOpenMenu.Click += new System.Windows.RoutedEventHandler(this.ButtonOpenMenu_Click);

            #line default
            #line hidden
                return;

            case 68:

            #line 693 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 69:
                this.ButtonClose = ((System.Windows.Controls.Button)(target));

            #line 696 "..\..\MainWindow.xaml"
                this.ButtonClose.Click += new System.Windows.RoutedEventHandler(this.ButtonClose_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Пример #7
0
        public void Wipe(TransitionerSlide fromSlide, TransitionerSlide toSlide, Point origin, IZIndexController zIndexController)
        {
            if (fromSlide == null)
            {
                throw new ArgumentNullException(nameof(fromSlide));
            }
            if (toSlide == null)
            {
                throw new ArgumentNullException(nameof(toSlide));
            }
            if (zIndexController == null)
            {
                throw new ArgumentNullException(nameof(zIndexController));
            }

            // Set up time points
            var zeroKeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);
            var endKeyTime  = KeyTime.FromTimeSpan(Duration);

            // Set up coordinates
            double fromStartX = 0, fromEndX = 0, toStartX = 0, toEndX = 0;
            double fromStartY = 0, fromEndY = 0, toStartY = 0, toEndY = 0;

            if (Direction == SlideDirection.Left)
            {
                fromEndX = -fromSlide.ActualWidth;
                toStartX = toSlide.ActualWidth;
            }
            else if (Direction == SlideDirection.Right)
            {
                fromEndX = fromSlide.ActualWidth;
                toStartX = -toSlide.ActualWidth;
            }
            else if (Direction == SlideDirection.Up)
            {
                fromEndY = -fromSlide.ActualHeight;
                toStartY = toSlide.ActualHeight;
            }
            else if (Direction == SlideDirection.Down)
            {
                fromEndY = fromSlide.ActualHeight;
                toStartY = -toSlide.ActualHeight;
            }

            // From
            var fromTransform = new TranslateTransform(fromStartX, fromStartY);

            fromSlide.RenderTransform = fromTransform;
            var fromXAnimation = new DoubleAnimationUsingKeyFrames();

            fromXAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(fromStartX, zeroKeyTime));
            fromXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(fromEndX, endKeyTime, _sineEase));
            var fromYAnimation = new DoubleAnimationUsingKeyFrames();

            fromYAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(fromStartY, zeroKeyTime));
            fromYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(fromEndY, endKeyTime, _sineEase));

            // To
            var toTransform = new TranslateTransform(toStartX, toStartY);

            toSlide.RenderTransform = toTransform;
            var toXAnimation = new DoubleAnimationUsingKeyFrames();

            toXAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(toStartX, zeroKeyTime));
            toXAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(toEndX, endKeyTime, _sineEase));
            var toYAnimation = new DoubleAnimationUsingKeyFrames();

            toYAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(toStartY, zeroKeyTime));
            toYAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(toEndY, endKeyTime, _sineEase));

            // Set up events
            fromXAnimation.Completed += (sender, args) =>
            {
                fromTransform.BeginAnimation(TranslateTransform.XProperty, null);
                fromTransform.X           = fromEndX;
                fromSlide.RenderTransform = null;
            };
            fromYAnimation.Completed += (sender, args) =>
            {
                fromTransform.BeginAnimation(TranslateTransform.YProperty, null);
                fromTransform.Y           = fromEndY;
                fromSlide.RenderTransform = null;
            };
            toXAnimation.Completed += (sender, args) =>
            {
                toTransform.BeginAnimation(TranslateTransform.XProperty, null);
                toTransform.X           = toEndX;
                toSlide.RenderTransform = null;
            };
            toYAnimation.Completed += (sender, args) =>
            {
                toTransform.BeginAnimation(TranslateTransform.YProperty, null);
                toTransform.Y           = toEndY;
                toSlide.RenderTransform = null;
            };

            // Animate
            fromTransform.BeginAnimation(TranslateTransform.XProperty, fromXAnimation);
            fromTransform.BeginAnimation(TranslateTransform.YProperty, fromYAnimation);
            toTransform.BeginAnimation(TranslateTransform.XProperty, toXAnimation);
            toTransform.BeginAnimation(TranslateTransform.YProperty, toYAnimation);
            zIndexController.Stack(toSlide, fromSlide);
        }
Пример #8
0
        public void Wipe(TransitionerSlide fromSlide, TransitionerSlide toSlide, Point origin, IZIndexController zIndexController)
        {
            if (fromSlide == null)
            {
                throw new ArgumentNullException(nameof(fromSlide));
            }
            if (toSlide == null)
            {
                throw new ArgumentNullException(nameof(toSlide));
            }
            if (zIndexController == null)
            {
                throw new ArgumentNullException(nameof(zIndexController));
            }

            var horizontalProportion = Math.Max(1.0 - origin.X, 1.0 * origin.X);
            var verticalProportion   = Math.Max(1.0 - origin.Y, 1.0 * origin.Y);
            var radius = Math.Sqrt(Math.Pow(toSlide.ActualWidth * horizontalProportion, 2) + Math.Pow(toSlide.ActualHeight * verticalProportion, 2));

            var scaleTransform     = new ScaleTransform(0, 0);
            var translateTransform = new TranslateTransform(toSlide.ActualWidth * origin.X, toSlide.ActualHeight * origin.Y);
            var transformGroup     = new TransformGroup();

            transformGroup.Children.Add(scaleTransform);
            transformGroup.Children.Add(translateTransform);
            var ellipseGeomotry = new EllipseGeometry()
            {
                RadiusX   = radius,
                RadiusY   = radius,
                Transform = transformGroup
            };

            toSlide.SetCurrentValue(UIElement.ClipProperty, ellipseGeomotry);
            zIndexController.Stack(toSlide, fromSlide);

            var zeroKeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);
            var midKeyTime  = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200));
            var endKeyTime  = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400));

            var opacityAnimation = new DoubleAnimationUsingKeyFrames();

            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, zeroKeyTime));
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, midKeyTime));
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime));
            opacityAnimation.Completed += (sender, args) =>
            {
                fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
            };
            fromSlide.BeginAnimation(UIElement.OpacityProperty, opacityAnimation);

            var scaleAnimation = new DoubleAnimationUsingKeyFrames();

            scaleAnimation.Completed += (sender, args) =>
            {
                toSlide.SetCurrentValue(UIElement.ClipProperty, null);
                fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
            };
            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, zeroKeyTime));
            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, endKeyTime));
            scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation);
            scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation);
        }
Пример #9
0
        public void Wipe(TransitionerSlide fromSlide, TransitionerSlide toSlide, Point origin, IZIndexController zIndexController)
        {
            if (fromSlide == null)
            {
                throw new ArgumentNullException(nameof(fromSlide));
            }
            if (toSlide == null)
            {
                throw new ArgumentNullException(nameof(toSlide));
            }
            if (zIndexController == null)
            {
                throw new ArgumentNullException(nameof(zIndexController));
            }

            var zeroKeyTime   = KeyTime.FromTimeSpan(TimeSpan.Zero);
            var midishKeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200));
            var endKeyTime    = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400));

            //back out old slide setup
            var scaleTransform = new ScaleTransform(1, 1);

            fromSlide.RenderTransform = scaleTransform;
            var scaleAnimation = new DoubleAnimationUsingKeyFrames();

            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, zeroKeyTime));
            scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(.8, endKeyTime));
            scaleAnimation.Completed += (sender, args) =>
            {
                fromSlide.RenderTransform = null;
            };
            var opacityAnimation = new DoubleAnimationUsingKeyFrames();

            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, zeroKeyTime));
            opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime));
            opacityAnimation.Completed += (sender, args) =>
            {
                fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
                fromSlide.Opacity = 0;
            };

            //slide in new slide setup
            var translateTransform = new TranslateTransform(0, toSlide.ActualHeight);

            toSlide.RenderTransform = translateTransform;
            var slideAnimation = new DoubleAnimationUsingKeyFrames();

            slideAnimation.KeyFrames.Add(new LinearDoubleKeyFrame(toSlide.ActualHeight, zeroKeyTime));
            slideAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(toSlide.ActualHeight, midishKeyTime)
            {
                EasingFunction = _sineEase
            });
            slideAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime)
            {
                EasingFunction = _sineEase
            });

            //kick off!
            translateTransform.BeginAnimation(TranslateTransform.YProperty, slideAnimation);
            scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation);
            scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation);
            fromSlide.BeginAnimation(UIElement.OpacityProperty, opacityAnimation);

            zIndexController.Stack(toSlide, fromSlide);
        }