private void OnItemAddedAnimation_Ended(object sender, AnimationEndedEventArgs e) { SingleItemAnimationContext context = this.GetAnimationContextForTarget(e.AnimationInfo.Target as RadVirtualizingDataControlItem, true); RadAnimation endedAnimation = sender as RadAnimation; this.OnItemAddedAnimationEnded(endedAnimation, context); }
internal virtual void OnItemRemovedAnimationEnded(RadAnimation animation, SingleItemAnimationContext context) { // When a remove animation ends we take it from the queue and... if (context != null) { context.AssociatedItem.Visibility = Visibility.Collapsed; this.scheduledRemoveAnimations.Remove(context); } // In case the animated container is already recycled - we hide it. This happens // when a single item remove animation has been started, not a batch one. if (!this.itemRemovedBatchAnimationScheduled && context != null) { if (this.realizedItems.Count > 0) { this.virtualizationStrategy.OnAfterItemRemovedAnimationEnded(context); } else { this.CleanupAfterCollectionReset(); } } else { if (this.scheduledRemoveAnimations.Count == 0) { this.itemRemovedBatchAnimationScheduled = false; this.CleanupAfterCollectionReset(); if (this.listSource.Count == 0) { if (this.ItemsSource == null) { this.ClearReycledItems(); } } else { this.BalanceVisualSpace(); } } } if (this.scheduledRemoveAnimations.Count == 0) { this.virtualizationStrategy.RecalculateViewportMeasurements(); } if (this.scheduledRemoveAnimations.Count == 0 && !this.IsLoaded) { this.itemRemovedAnimationCache.Ended -= this.OnItemRemovedAnimation_Ended; } this.OnItemAnimationEnded(new ItemAnimationEndedEventArgs() { Animation = animation, RemainingAnimationsCount = this.scheduledRemoveAnimations.Count }); }
internal virtual void OnItemAddedAnimationEnded(RadAnimation animation, SingleItemAnimationContext context) { this.scheduledAddAnimations.Remove(context); context.AssociatedItem.scheduledForBatchAnimation = false; if (this.scheduledAddAnimations.Count == 0 && !this.IsLoaded) { this.itemAddedAnimationCache.Ended -= this.OnItemAddedAnimation_Ended; } this.OnItemAnimationEnded(new ItemAnimationEndedEventArgs() { Animation = animation, RemainingAnimationsCount = this.scheduledAddAnimations.Count }); }
public GamePage() { InitializeComponent(); Loaded += GamePageLoaded; _tapAnimation = CreateSelectedAnimation(); _tapWrongAnimation = WrongTapAnimation(); _answerFoundTime = new List<int>(); _random = new Random(); _stopWatchStarted = false; InitializeBombAnimation(); }
private void OnItemAddedAnimationChanged(DependencyPropertyChangedEventArgs args) { this.StopAllAddedAnimations(); if (this.itemAddedAnimationCache != null) { this.itemAddedAnimationCache.Ended -= this.OnItemAddedAnimation_Ended; } this.itemAddedAnimationCache = args.NewValue as RadAnimation; if (this.itemAddedAnimationCache != null) { this.itemAddedAnimationCache.Ended += this.OnItemAddedAnimation_Ended; this.itemAddedAnimationCache.RepeatBehavior = null; } }
internal override void OnItemRemovedAnimationEnded(RadAnimation animation, SingleItemAnimationContext context) { base.OnItemRemovedAnimationEnded(animation, context); if (this.realizedItems.Count > 0 && this.listSource.Count > 0) { SingleItemAnimationContext[] animatedItems = this.scheduledRemoveAnimations.ToArray(); foreach (SingleItemAnimationContext ctxt in animatedItems) { if (ctxt.RealizedIndex == 0) { return; } } this.PositionPullToRefreshIndicator(); } }
internal virtual void OnItemRemovedBatchAnimation() { FrameworkElement[] viewportItems = this.ViewportItems; RadAnimation itemRemovedAnimation = this.itemRemovedAnimationCache; TimeSpan interval = this.ItemRemovedAnimationInterval; TimeSpan defaultDelay = itemRemovedAnimation.InitialDelay; foreach (RadVirtualizingDataControlItem container in viewportItems) { if (!this.CanPlayAnimationForItem(container, false)) { continue; } this.PlaySingleItemRemovedAnimation(container); this.virtualizationStrategy.RecycleItem(container, false); itemRemovedAnimation.InitialDelay += interval; } itemRemovedAnimation.InitialDelay = defaultDelay; }
internal virtual void OnItemAddedBatchAnimation() { this.itemAddedBatchAnimationScheduled = false; RadAnimation itemAddedAnimation = this.itemAddedAnimationCache; TimeSpan interval = this.ItemAddedAnimationInterval; TimeSpan defaultDelay = itemAddedAnimation.InitialDelay; foreach (RadVirtualizingDataControlItem container in this.realizedItems) { if (!container.scheduledForBatchAnimation) { continue; } this.PlaySingleItemAddedAnimation(container); itemAddedAnimation.InitialDelay += interval; } itemAddedAnimation.InitialDelay = defaultDelay; }
private void PlayCountDownAnimation(TextBlock tb, RadAnimation scaleAndFade, Rectangle cover) { RadAnimationManager.Play(tb, scaleAndFade, () => Dispatcher.BeginInvoke(() => { var num = (int)tb.Tag; if (num == 3) { var chapter = StageUnlockManager.Instance.ChapterOfStage(_stage); var stageName = LocalizedResources.Stage(chapter.StageNumber(_stage)); tb.Text = stageName; tb.Tag = 2; PlayCountDownAnimation(tb, scaleAndFade, cover); } else if (num == 2) { tb.Text = LocalizedResources.LocalizedStringResource.Ready; tb.Tag = 1; tb.FontSize = 60; PlayCountDownAnimation(tb, scaleAndFade, cover); } else { tb.Text = LocalizedResources.LocalizedStringResource.Go; tb.Tag = 0; tb.FontSize = 120; GameStart(); RadAnimationManager.Play(tb, scaleAndFade, () => tb.Text = string.Empty); RadAnimationManager.Play(cover, new RadFadeAnimation { StartOpacity = 1, EndOpacity = 0, Duration = TimeSpan.FromSeconds(1), FillBehavior = AnimationFillBehavior.HoldEnd }, () => { tb.Visibility = Visibility.Collapsed; cover.Visibility = Visibility.Collapsed; }); } })); }
private RadAnimation BombFadeAnimation() { return _bombFadeAnimation ?? (_bombFadeAnimation = new RadFadeAnimation { StartOpacity = 1, EndOpacity = 0, Duration = new Duration(TimeSpan.FromSeconds(1)), FillBehavior = AnimationFillBehavior.Stop }); }
private void PlayCountDownAnimation(TextBlock tb, RadAnimation scaleAndFade, Rectangle cover) { RadAnimationManager.Play(tb, scaleAndFade, () => Dispatcher.BeginInvoke( () => { int num; if (int.TryParse(tb.Text, out num) && num > 1) { tb.Text = (--num).ToString(CultureInfo.InvariantCulture); PlayCountDownAnimation(tb, scaleAndFade, cover); } else { tb.Text = "GO!"; GameStart(); RadAnimationManager.Play(tb, scaleAndFade); RadAnimationManager.Play(cover, new RadFadeAnimation { StartOpacity = 1, EndOpacity = 0, Duration = TimeSpan.FromSeconds(1), FillBehavior = AnimationFillBehavior.HoldEnd }, () => { tb.Visibility = Visibility.Collapsed; cover.Visibility = Visibility.Collapsed; }); } })); }