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); }
private ViewTable EnsureViewTableForCollection(object collection) { ViewTable item = this[collection]; if (item == null) { item = new ViewTable(); this[collection] = item; } return(item); }
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)); }
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); } }
private ViewTable EnsureViewTableForCollection(object collection) { ViewTable item = this[collection]; if (item == null) { item = new ViewTable(); this[collection] = item; } return item; }