Exemple #1
0
        private void InitializeCollectionFacades()
        {
            if (serviceCollection == null)
            {
                serviceCollection = new ServiceCollection(lifetime, locator, builder,
                                                          parent == null ? null : parent.serviceCollection);
            }

            if (commandCollection == null)
            {
                commandCollection = new ManagedObjectCollection <Command>(lifetime, locator, builder,
                                                                          SearchMode.Up, CreateCommand, null, parent == null ? null : parent.commandCollection);
            }

            if (workItemCollection == null)
            {
                workItemCollection = new ManagedObjectCollection <WorkItem>(lifetime, locator, builder,
                                                                            SearchMode.Local, null, null, parent == null ? null : parent.workItemCollection);
            }

            if (workspaceCollection == null)
            {
                workspaceCollection = new ManagedObjectCollection <IWorkspace>(lifetime, locator, builder,
                                                                               SearchMode.Up, null, null, parent == null ? null : parent.workspaceCollection);
            }

            if (itemsCollection == null)
            {
                itemsCollection = new ManagedObjectCollection <object>(lifetime, locator, builder,
                                                                       SearchMode.Local, null, null, parent == null ? null : parent.itemsCollection);
            }

            if (smartPartCollection == null)
            {
                smartPartCollection = new ManagedObjectCollection <object>(lifetime, locator, builder,
                                                                           SearchMode.Local, null, delegate(object obj)
                {
                    return(obj.GetType().GetCustomAttributes(typeof(SmartPartAttribute), true).Length > 0);
                },
                                                                           parent == null ? null : parent.smartPartCollection);
            }

            if (eventTopicCollection == null)
            {
                if (parent == null)
                {
                    eventTopicCollection = new ManagedObjectCollection <EventTopic>(lifetime, locator, builder,
                                                                                    SearchMode.Local, CreateEventTopic, null, null);
                }
                else
                {
                    eventTopicCollection = RootWorkItem.eventTopicCollection;
                }
            }

            if (uiExtensionSiteCollection == null)
            {
                if (parent == null)
                {
                    uiExtensionSiteCollection = new UIExtensionSiteCollection(this);
                }
                else
                {
                    uiExtensionSiteCollection = new UIExtensionSiteCollection(parent.uiExtensionSiteCollection);
                }
            }
        }
 private TestableManagedObjectCollection <object> CreateManagedObjectCollection(SearchMode searchMode, ManagedObjectCollection <object> .IndexerCreationDelegate indexerCreationDelegate)
 {
     return(CreateManagedObjectCollection(searchMode, indexerCreationDelegate, delegate(object obj) { return true; }));
 }
        private TestableManagedObjectCollection <object> CreateManagedObjectCollection(SearchMode searchMode, ManagedObjectCollection <object> .IndexerCreationDelegate indexerCreationDelegate, Predicate <object> filter)
        {
            LifetimeContainer container = new LifetimeContainer();
            Locator           locator   = new Locator();

            locator.Add(typeof(ILifetimeContainer), container);

            return(new TestableManagedObjectCollection <object>(container, locator, CreateBuilder(), searchMode, indexerCreationDelegate, filter, null));
        }