コード例 #1
0
        public void Clear()
        {
            inProgress = true;

            DoubleAnimation fadeOutRun  = new DoubleAnimation(0.0, TimeSpan.FromMilliseconds(1000));
            DoubleAnimation fadeOutList = new DoubleAnimation(0.0, TimeSpan.FromMilliseconds(1000));

            fadeOutRun.Completed += (s, e) =>
            {
                NextRunControl.Clear();
                inProgress = false;
            };

            fadeOutList.Completed += (s, e) =>
            {
                MainCardsStack.Children.Clear();
                UpdateLayout();
                MainCardsScroll.ScrollToTop();

                MainCardsScroll.BeginAnimation(OpacityProperty, null);
                MainCardsScroll.Opacity = 1.0;
            };

            NextRunControl.BeginAnimation(OpacityProperty, fadeOutRun);
            MainCardsScroll.BeginAnimation(OpacityProperty, fadeOutList);
        }
コード例 #2
0
        public bool RevealNextRun(Run run, double speedMul = 1.0)
        {
            if (speedMul < 0.01)
            {
                speedMul = 0.01;
            }

            if (inProgress)
            {
                return(false);
            }
            inProgress = true;

            Run prevRun = NextRunControl.ToRun();

            if (prevRun != null && prevRun.Game != "")
            {
                prevRun.PropertyChanged -= CurRunPropChanged;
                AddRunToList(prevRun, speedMul);
            }

            if (run != null && run.Game != "")
            {
                run.PropertyChanged += CurRunPropChanged;
            }

            DoubleAnimation fadeOut = new DoubleAnimation(0.0, TimeSpan.FromMilliseconds(2000 * speedMul));
            DoubleAnimation fadeIn  = new DoubleAnimation(1.0, TimeSpan.FromMilliseconds(2000 * speedMul));

            fadeIn.BeginTime   = TimeSpan.FromMilliseconds(2500 * speedMul);
            fadeOut.BeginTime  = TimeSpan.FromMilliseconds(2000 * speedMul);
            fadeOut.Completed += (s, e) =>
            {
                if (run == null || run.Game == "")
                {
                    inProgress = false;
                    NextRunControl.Clear();
                }
                else
                {
                    NextRunControl.FromRun(run);

                    NextRunControl.BeginAnimation(OpacityProperty, fadeIn);
                    inProgress = false;
                }
            };

            NextRunControl.BeginAnimation(OpacityProperty, fadeOut);

            return(true);
        }
コード例 #3
0
        private void CurRunPropChanged(object sender, PropertyChangedEventArgs _)
        {
            Run run = (Run)sender;

            if (!run.Presented)
            {
                run.PropertyChanged -= CurRunPropChanged;

                inProgress = true;

                DoubleAnimation fadeOut = new DoubleAnimation(0.0, TimeSpan.FromMilliseconds(250));
                fadeOut.Completed += (s, e) =>
                {
                    inProgress = false;
                    NextRunControl.Clear();
                };
                NextRunControl.BeginAnimation(OpacityProperty, fadeOut);
            }
        }
コード例 #4
0
        public void AddRunToList(Run run, double speedMul = 1.0)
        {
            if (speedMul < 0.01)
            {
                speedMul = 0.01;
            }

            if (run == null || run.Game == "")
            {
                return;
            }

            ScheduleItemControl ctrl = new ScheduleItemControl();

            ctrl.FromRun(NextRunControl.ToRun());

            var margin = ctrl.Margin;

            margin.Bottom = 5;
            ctrl.Margin   = margin;

            ctrl.Opacity = 0.0;

            MainCardsStack.Children.Add(ctrl);
            UpdateLayout();

            DoubleAnimation scrollDown = new DoubleAnimation(MainCardsScroll.VerticalOffset, MainCardsScroll.ScrollableHeight, TimeSpan.FromMilliseconds(2000 * speedMul));

            scrollDown.EasingFunction = new BounceEase {
                EasingMode = EasingMode.EaseOut
            };
            scrollDown.Completed += (s, e) =>
            {
                DoubleAnimation fadeIn = new DoubleAnimation(1.0, TimeSpan.FromMilliseconds(2000 * speedMul));
                fadeIn.BeginTime = TimeSpan.FromMilliseconds(500 * speedMul);
                ctrl.BeginAnimation(OpacityProperty, fadeIn);
            };

            BeginAnimation(ScrollOffsetProperty, scrollDown);
        }