Ejemplo n.º 1
0
        public AnimationElements GetAnimationElements(string uniqueId)
        {
            if (this.UnusedAnimationElements.Count == 0)
            {
                AnimationElements animationElements = new AnimationElements();

                animationElements.Storyboard = new Storyboard();
                animationElements.Image = AnimationManager.GetImage();

                animationElements.Image.Name = uniqueId;

                DoubleAnimation doubleAnimation = AnimationManager.GetAnimation();

                animationElements.Storyboard.Duration = doubleAnimation.Duration;

                Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath("(Canvas.Left)"));
                Storyboard.SetTarget(doubleAnimation, animationElements.Image);
                animationElements.Storyboard.Children.Add(doubleAnimation);

                this.AllAnimationElements.Add(animationElements);

                return animationElements;
            }
            else
            {
                AnimationElements animationElements = this.UnusedAnimationElements[this.UnusedAnimationElements.Count - 1];
                this.UnusedAnimationElements.RemoveAt(this.UnusedAnimationElements.Count - 1);
                return animationElements;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>. In simplest terms, this means the method is called just before a UI element displays in an application. For more information, see Remarks.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            GridRoot = GetTemplateChild("GridRoot") as Grid;
            if (GridRoot == null)
            {
                throw new NotImplementedException("GridRoot is required to display LoadingIndicator.");
            }

            for (int i = 0; i < 12; i++)
            {
                AnimationElements.Add(GetTemplateChild(string.Format("Element{0}", i)) as FrameworkElement);
            }

            CreateAnimation();
        }
Ejemplo n.º 3
0
 public override void UpdateHtml()
 {
     ChildShapes.ForEach(e => e.UpdateHtml());
     AnimationElements.ForEach(a => a.UpdateHtml());
     StoredHtml = $"<g{string.Join("", Element.Attributes.Select(a => $" {a.Name}=\"{a.Value}\""))}>\n" + string.Join("", ChildShapes.Select(e => e.StoredHtml + "\n")) + string.Join("", AnimationElements.Select(a => a.StoredHtml + "\n")) + "</g>";
 }