Пример #1
0
        /// <summary>
        /// Initializes the pool.
        /// </summary>
        public void Initialize()
        {
            if (pool != null)
                return;

            this.pool = new PoolImpl(Ultraviolet, 32, 256, () => new SimpleClock(LoopBehavior.None, TimeSpan.Zero));
        }
Пример #2
0
        /// <summary>
        /// Ensures that the underlying pool exists.
        /// </summary>
        public void Initialize()
        {
            if (pool != null)
                return;

            this.pool = new PoolImpl(Ultraviolet, 32, 256, () => new StoryboardClock());
        }
Пример #3
0
        /// <summary>
        /// Ensures that the out-of-band renderer's internal pools have been created.
        /// </summary>
        public void InitializePools()
        {
            if (renderTargetPool != null)
                return;

            renderTargetPool = new UpfPool<OutOfBandRenderTarget>(Ultraviolet, 8, 32, () => new OutOfBandRenderTarget(Ultraviolet));
        }
Пример #4
0
        /// <summary>
        /// Releases a storyboard instance into the pool.
        /// </summary>
        /// <param name="storyboardInstance">The storyboard instance to release into the pool.</param>
        public void Release(UpfPool <StoryboardInstance> .PooledObject storyboardInstance)
        {
            Contract.Require(storyboardInstance, nameof(storyboardInstance));
            Contract.EnsureNotDisposed(this, Disposed);

            Initialize();

            pool.Release(storyboardInstance);
        }
Пример #5
0
        /// <summary>
        /// Releases a storyboard instance into the pool.
        /// </summary>
        /// <param name="storyboardInstance">The storyboard instance to release into the pool.</param>
        public void Release(UpfPool<StoryboardInstance>.PooledObject storyboardInstance)
        {
            Contract.Require(storyboardInstance, nameof(storyboardInstance));
            Contract.EnsureNotDisposed(this, Disposed);

            Initialize();

            pool.Release(storyboardInstance);
        }
        /// <summary>
        /// Releases a clock into the pool.
        /// </summary>
        /// <param name="clock">The clock to release into the pool.</param>
        public void Release(UpfPool <SimpleClock> .PooledObject clock)
        {
            Contract.Require(clock, nameof(clock));
            Contract.EnsureNotDisposed(this, Disposed);

            Initialize();

            clock.Value.PooledObject = null;
            pool.Release(clock);
        }
Пример #7
0
        /// <summary>
        /// Releases a clock into the pool.
        /// </summary>
        /// <param name="clock">The clock to release into the pool.</param>
        public void Release(UpfPool<SimpleClock>.PooledObject clock)
        {
            Contract.Require(clock, nameof(clock));
            Contract.EnsureNotDisposed(this, Disposed);

            Initialize();

            clock.Value.PooledObject = null;
            pool.Release(clock);
        }
Пример #8
0
        /// <summary>
        /// Releases a clock into the pool.
        /// </summary>
        /// <param name="clock">The clock to release into the pool.</param>
        public void Release(UpfPool<StoryboardClock>.PooledObject clock)
        {
            Contract.Require(clock, nameof(clock));
            Contract.EnsureNotDisposed(this, Disposed);

            Initialize();

            clock.Value.StoryboardInstance.Stop();
            clock.Value.StoryboardInstance = null;
            pool.Release(clock);
        }
Пример #9
0
        /// <summary>
        /// Releases a clock into the pool.
        /// </summary>
        /// <param name="clock">The clock to release into the pool.</param>
        public void Release(UpfPool <StoryboardClock> .PooledObject clock)
        {
            Contract.Require(clock, nameof(clock));
            Contract.EnsureNotDisposed(this, Disposed);

            Initialize();

            clock.Value.StoryboardInstance.Stop();
            clock.Value.StoryboardInstance = null;
            pool.Release(clock);
        }
Пример #10
0
        /// <summary>
        /// Associates the instance with the specified storyboard and element.
        /// </summary>
        /// <param name="storyboard">The <see cref="Storyboard"/> with which to associate the instance.</param>
        /// <param name="clock">The <see cref="StoryboardClock"/> with which to associate the instance.</param>
        /// <param name="target">The <see cref="UIElement"/> with which is targeted by the instance.</param>
        internal void AssociateWith(Storyboard storyboard, UpfPool<StoryboardClock>.PooledObject clock, UIElement target)
        {
            Contract.Require(storyboard, nameof(storyboard));
            Contract.Require(clock, nameof(clock));
            Contract.Require(target, nameof(target));

            if (this.storyboard != null)
                throw new InvalidOperationException();

            this.storyboard = storyboard;
            this.clock = clock;
            this.target = target;
        }
Пример #11
0
        /// <summary>
        /// Associates the instance with the specified storyboard and element.
        /// </summary>
        /// <param name="storyboard">The <see cref="Storyboard"/> with which to associate the instance.</param>
        /// <param name="clock">The <see cref="StoryboardClock"/> with which to associate the instance.</param>
        /// <param name="target">The <see cref="UIElement"/> with which is targeted by the instance.</param>
        internal void AssociateWith(Storyboard storyboard, UpfPool <StoryboardClock> .PooledObject clock, UIElement target)
        {
            Contract.Require(storyboard, nameof(storyboard));
            Contract.Require(clock, nameof(clock));
            Contract.Require(target, nameof(target));

            if (this.storyboard != null)
            {
                throw new InvalidOperationException();
            }

            this.storyboard = storyboard;
            this.clock      = clock;
            this.target     = target;
        }
Пример #12
0
        /// <summary>
        /// Disassociates the instance from its current storyboard and element.
        /// </summary>
        internal void Disassociate()
        {
            if (this.storyboard == null)
                return;

            Stop();

            if (this.clock != null)
                StoryboardClockPool.Instance.Release(this.clock);

            this.storyboard = null;
            this.clock = null;
            this.target = null;

            this.enlistedDependencyProperties.Clear();
        }