Beispiel #1
0
        public void Recycle()
        {
            _needVisualiseFlag = false;

            if (Visual == null)
            {
                return;
            }

            if (IsMouseHover)
            {
                MouseLeave?.Invoke();
                IsMouseHover       = false;
                _needVisualiseFlag = false;
                Layer.MouseHoverFragments.Remove(this);
            }

            Layer.RemoveVisual(Visual);
            Layer.VisibleFragments.Remove(this);

            Visual.SetDataContext(null);

            VisualPool.Recycle(Visual);

            Visual = null;
        }
Beispiel #2
0
 public VisualPool GetVisualPool(Type visualType)
 {
     if (_VisualPools.TryGetValue(visualType, out var pool) == false)
     {
         pool = new VisualPool(visualType);
         _VisualPools[visualType] = pool;
     }
     return(pool);
 }
Beispiel #3
0
        private void CreateVisual()
        {
            // najde/vytvori VisualPool pre VisualType, ziska visual z poolu, nastavi this.Visual

            if (VisualPool == null)
            {
                VisualPool = View.GetVisualPool(VisualType);
            }

            Visual = VisualPool.GetFresh();

            Layer.AddVisual(Visual);
            Layer.VisibleFragments.Add(this);

            if (Visual is UIElement)
            {
                _needVisualiseFlag = true; // Adding UIElement to ContainerVisual during Arrange phase triggers second Arrange later.
            }
        }