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); }
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); }
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); } }