internal virtual RadVirtualizingDataControlItem GetContainerForItem(IDataSourceItem item, int insertAt)
        {
            RadVirtualizingDataControlItem cp = null;

            if (this.owner.recycledItems.Count == 0)
            {
                cp = this.owner.GenerateContainerForItem(item);
            }
            else
            {
                cp = this.owner.recycledItems.Dequeue();

                if ((this.owner.itemAddedAnimationCache != null && RadAnimationManager.IsAnimationScheduled(cp, this.owner.itemAddedAnimationCache)) ||
                    (this.owner.itemRemovedAnimationCache != null && RadAnimationManager.IsAnimationScheduled(cp, this.owner.itemRemovedAnimationCache)))
                {
                    this.owner.recycledItems.Enqueue(cp);
                    cp = this.owner.GenerateContainerForItem(item);
                }
                else
                {
                    this.owner.OnContainerStateChanged(cp, item, ItemState.Realizing);
                    this.owner.PrepareContainerForItemInternal(cp, item);
                    cp.Visibility = Visibility.Visible;
                }
            }

            this.MeasureContainer(cp);

            this.InsertIntoViewport(cp, insertAt);

            this.owner.firstItemCache = this.owner.realizedItems[0];
            this.owner.lastItemCache  = this.owner.realizedItems[this.owner.realizedItems.Count - 1];

            return(cp);
        }
Exemplo n.º 2
0
        internal void PlayCheckModeAnimation(UIElement element, bool forward, bool beforeItem, double itemLength)
        {
            var animation = new RadMoveAnimation()
            {
                Duration = TimeSpan.FromSeconds(0.3), FillBehavior = AnimationFillBehavior.HoldEnd
            };

            animation.StartPoint = new Point(0, 0);
            itemLength           = itemLength == 0 ? 29 : itemLength;
            var offset = beforeItem ? itemLength : -itemLength;

            animation.EndPoint = this.Owner.Orientation == Windows.UI.Xaml.Controls.Orientation.Vertical ? new Point(offset, 0) : new Point(0, offset);

            if (forward)
            {
                animation.Ended += this.ForwardCheckModeAnimationEnded;
            }
            else
            {
                animation        = animation.CreateOpposite() as RadMoveAnimation;
                animation.Ended += this.BackwardsCheckModeAnimationEnded;
            }

            RadAnimationManager.Play(element, animation);
        }
Exemplo n.º 3
0
 internal void StopAnimations()
 {
     while (this.runningAnimations.Count > 0)
     {
         RadAnimationManager.StopIfRunning(this.GetContainerForItem(this.runningAnimations.Values.First().Item1) as FrameworkElement, this.runningAnimations.Keys.First());
     }
 }
Exemplo n.º 4
0
        internal void PlayNewSourceAnimation(Action <object> callback)
        {
            var animation = this.CreateAnimation(AnimationTrigger.NewSource);

            this.runningAnimations.Add(animation, new Tuple <object, Action <object> >(this.Owner.animatingChildrenPanel, callback));

            RadAnimationManager.Play(this.Owner.animatingChildrenPanel, animation);
        }
 internal void StopAllRemovedAnimations()
 {
     while (this.scheduledRemoveAnimations.Count > 0)
     {
         // Here we do not need to enqueue the top item since the ForceStop method will invoke the RadAnimation.Ended event where
         // this is done.
         SingleItemAnimationContext context = this.scheduledRemoveAnimations[0];
         RadAnimationManager.ForceStop(context.AssociatedItem, this.itemRemovedAnimationCache);
     }
 }
Exemplo n.º 6
0
        internal virtual void PlaySingleItemRemovedAnimation(RadVirtualizingDataControlItem item)
        {
            int realizedIndex = item.associatedDataItem.Index - this.owner.firstItemCache.associatedDataItem.Index;

            RadAnimationManager.Play(item, this.owner.itemRemovedAnimationCache);
            this.owner.scheduledRemoveAnimations.Add(new SingleItemAnimationContext()
            {
                AssociatedItem = item, RealizedLength = this.GetItemLength(item), RealizedIndex = realizedIndex
            });
        }
Exemplo n.º 7
0
        internal void StopAnimation(object item)
        {
            var animation = this.runningAnimations.Single((keyValuePair) =>
            {
                if (keyValuePair.Value.Item1.Equals(item))
                {
                    return(true);
                }
                return(false);
            }).Key;

            RadAnimationManager.StopIfRunning(this.GetContainerForItem(item) as FrameworkElement, animation);
        }
Exemplo n.º 8
0
        internal void PlayItemAddedAnimations(Action <object> callback)
        {
            foreach (var scheduledItem in this.scheduledItemsForAnimation)
            {
                foreach (var displayedItem in this.Owner.Model.ForEachDisplayedElement())
                {
                    if (displayedItem.ItemInfo.Item.Equals(scheduledItem))
                    {
                        var animation = this.CreateAnimation(AnimationTrigger.AddedItem);
                        displayedItem.IsAnimating = true;
                        RadAnimationManager.Play(displayedItem.Container as FrameworkElement, animation);

                        this.runningAnimations.Add(animation, new Tuple <object, Action <object> >(displayedItem, callback));
                    }
                }
            }

            this.scheduledItemsForAnimation.Clear();
        }
Exemplo n.º 9
0
        internal void PlayCheckBoxLayerAnimation(UIElement element, bool forward, bool beforeItem, double itemLength)
        {
            var checkBoxanimation = new RadMoveAnimation {
                Duration = TimeSpan.FromSeconds(0.3), FillBehavior = AnimationFillBehavior.HoldEnd
            };

            checkBoxanimation.EndPoint = new Point(0, 0);
            itemLength = itemLength == 0 ? 29 : itemLength;
            var offset = beforeItem ? itemLength : -itemLength;

            checkBoxanimation.StartPoint = this.Owner.Orientation == Windows.UI.Xaml.Controls.Orientation.Vertical ? new Point(-offset, 0) : new Point(0, -offset);

            if (!forward)
            {
                checkBoxanimation = checkBoxanimation.CreateOpposite() as RadMoveAnimation;
            }

            RadAnimationManager.Play(element, checkBoxanimation);
        }
Exemplo n.º 10
0
        internal void PlayItemRemovedAnimation(IList changedItems, Action <object> callback)
        {
            foreach (var changedItem in changedItems)
            {
                foreach (var displayedItem in this.Owner.Model.ForEachDisplayedElement())
                {
                    if (changedItem.Equals(displayedItem.ItemInfo.Item))
                    {
                        if (changedItem.Equals(this.Owner.CurrentItem))
                        {
                            var currencyVisual = this.Owner.currencyLayerCache.CurrencyVisual as IAnimated;
                            if (currencyVisual != null)
                            {
                                currencyVisual.IsAnimating = true;
                                var animation = this.Owner.ItemRemovedAnimation.Clone();
                                animation.FillBehavior = AnimationFillBehavior.Stop;
                                animation.Ended       += this.CurrentItemAnimationEnded;
                                RadAnimationManager.Play(currencyVisual.Container as FrameworkElement, animation);
                                this.runningAnimations.Add(animation, new Tuple <object, Action <object> >(currencyVisual, callback));
                            }
                        }

                        this.scheduledModelsForRecycle.Add(displayedItem);
                        displayedItem.IsAnimating = true;

                        if (displayedItem != null)
                        {
                            var animation = this.CreateAnimation(AnimationTrigger.RemovedItem);

                            this.runningAnimations.Add(animation, new Tuple <object, Action <object> >(displayedItem, callback));

                            RadAnimationManager.Play(displayedItem.Container as FrameworkElement, animation);
                        }
                        else
                        {
                            callback(null);
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
 private void OnIsLoadingPropertyChanged(bool newValue)
 {
     // control is in pageLoading state
     if (newValue)
     {
         this.ThreadPageLoadingBar.IsIndeterminate = true;
         this.ThreadPageLoadingBar.Visibility      = System.Windows.Visibility.Visible;
         RadAnimationManager.StopIfRunning(this.ThreadPageView, this.FadeInAnimation);
         RadAnimationManager.Play(this.ThreadPageView, this.FadeOutAnimation);
         this.OnPageLoading();
     }
     // control is in pageLoaded state
     else
     {
         this.ThreadPageLoadingBar.IsIndeterminate = false;
         this.ThreadPageLoadingBar.Visibility      = System.Windows.Visibility.Collapsed;
         RadAnimationManager.StopIfRunning(this.ThreadPageView, this.FadeOutAnimation);
         RadAnimationManager.Play(this.ThreadPageView, this.FadeInAnimation);
         this.OnPageLoaded();
     }
 }
Exemplo n.º 12
0
        void ShowField(bool show)
        {
            //make task rectangle invisible.
            taskRectangle.Visibility = show ? Visibility.Collapsed : Visibility.Visible;



            //make our rectangle visible
            drawRectangle.Visibility = show ? Visibility.Visible : Visibility.Collapsed;

            var rectangleFadeAnimation = Resources["rectangleFadeAnimation"] as RadFadeAnimation;

            if (rectangleFadeAnimation != null)
            {
                if (show)
                {
                    rectangleFadeAnimation.StartOpacity = 0.0;
                    rectangleFadeAnimation.EndOpacity   = 1.0;
                }
                else
                {
                    rectangleFadeAnimation.StartOpacity = 1.0;
                    rectangleFadeAnimation.EndOpacity   = 0.0;
                }

                RadAnimationManager.Play(drawRectangle, rectangleFadeAnimation);
            }

            //RadialGauge.Visibility = show ? Visibility.Visible : Visibility.Collapsed;


            //make buttons visible
            MakeButtonsVisible(show ? Visibility.Visible : Visibility.Collapsed);

            //make sliders enabled;
            MakeSlidersEnabled(show);

            CheckButton.IsEnabled = show;
        }