예제 #1
0
        private ViewRecord CreateAndCacheNewView(object collection, Appercode.UI.Data.CollectionViewSource cvs)
        {
            ICollectionView collectionViews = this.CreateNewView(collection);
            ViewTable       viewTable       = this.EnsureViewTableForCollection(collection);
            ViewRecord      viewRecord      = new ViewRecord(collectionViews);

            viewTable[cvs] = viewRecord;
            ((IViewLifetime)collectionViews).ViewManagerData = viewTable;
            this.Cleanup();
            return(viewRecord);
        }
예제 #2
0
        private ViewTable EnsureViewTableForCollection(object collection)
        {
            ViewTable item = this[collection];

            if (item == null)
            {
                item             = new ViewTable();
                this[collection] = item;
            }
            return(item);
        }
예제 #3
0
        internal ViewRecord GetViewRecord(object collection, Appercode.UI.Data.CollectionViewSource cvs)
        {
            ViewTable  item       = this[collection];
            ViewRecord viewRecord = null;

            if (item != null)
            {
                viewRecord = item[cvs];
                if (viewRecord != null)
                {
                    return(viewRecord);
                }
            }
            return(this.CreateAndCacheNewView(collection, cvs));
        }
예제 #4
0
 private ViewTable this[object o]
 {
     get
     {
         WeakRefKey    weakRefKey    = new WeakRefKey(o);
         WeakReference weakReference = null;
         ViewTable     target        = null;
         if (this.objectsToViewTables.TryGetValue(weakRefKey, out weakReference))
         {
             target = (ViewTable)weakReference.Target;
             if (target == null)
             {
                 this.objectsToViewTables.Remove(weakRefKey);
             }
         }
         return(target);
     }
     set
     {
         WeakRefKey weakRefKey = new WeakRefKey(o);
         this.objectsToViewTables[weakRefKey] = new WeakReference(value);
     }
 }
예제 #5
0
 private ViewTable EnsureViewTableForCollection(object collection)
 {
     ViewTable item = this[collection];
     if (item == null)
     {
         item = new ViewTable();
         this[collection] = item;
     }
     return item;
 }