示例#1
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                // call the clear!
                if (RecycleCache != null)
                {
                    foreach (RecyclerViewItem item in RecycleCache)
                    {
                        UnrealizeItem(item, false);
                    }
                    RecycleCache.Clear();
                }
                InternalItemsLayouter.Clear();
                InternalItemsLayouter = null;
                ItemsSource           = null;
                ItemTemplate          = null;
                if (InternalItemSource != null)
                {
                    InternalItemSource.Dispose();
                    InternalItemSource = null;
                }
                //
            }

            base.Dispose(type);
        }
示例#2
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                disposed = true;
                // call the clear!
                if (RecycleCache != null)
                {
                    foreach (RecyclerViewItem item in RecycleCache)
                    {
                        //ContentContainer.Remove(item);
                        Utility.Dispose(item);
                    }
                    RecycleCache.Clear();
                }
                InternalItemsLayouter.Clear();
                InternalItemsLayouter = null;
                ItemsSource           = null;
                ItemTemplate          = null;
                if (InternalItemSource != null)
                {
                    InternalItemSource.Dispose();
                }
                //
            }

            base.Dispose(type);
        }
示例#3
0
 protected virtual void ClearCache()
 {
     foreach (RecyclerViewItem item in RecycleCache)
     {
         Utility.Dispose(item);
     }
     RecycleCache.Clear();
 }
示例#4
0
 protected virtual RecyclerViewItem PopRecycleCache(DataTemplate Template)
 {
     for (int i = 0; i < RecycleCache.Count; i++)
     {
         RecyclerViewItem item = RecycleCache[i];
         if (item.Template == Template)
         {
             RecycleCache.Remove(item);
             item.Show();
             return(item);
         }
     }
     return(null);
 }
示例#5
0
 protected virtual bool PushRecycleCache(RecyclerViewItem item)
 {
     if (item == null)
     {
         throw new ArgumentNullException(nameof(item));
     }
     if (RecycleCache.Count >= CacheMax)
     {
         return(false);
     }
     if (item.Template == null)
     {
         return(false);
     }
     item.Hide();
     item.Index = -1;
     RecycleCache.Add(item);
     return(true);
 }