IEnumerator <string> IEnumerable <string> .GetEnumerator()
        {
            Set <string> seenNames = new Set <string>();

            for (UIExtensionSiteCollection current = this; current != null; current = current.parent)
            {
                foreach (string siteName in current.sites.Keys)
                {
                    if (!seenNames.Contains(siteName))
                    {
                        seenNames.Add(siteName);
                        yield return(siteName);
                    }
                }
            }
        }
Пример #2
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 UIExtensionSiteCollection(WorkItem rootWorkItem, UIExtensionSiteCollection parent)
 {
     this.parent       = parent;
     this.rootWorkItem = rootWorkItem;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UIExtensionSiteCollection"/> class using the provided
 /// parent <see cref="UIExtensionSiteCollection"/>.
 /// </summary>
 public UIExtensionSiteCollection(UIExtensionSiteCollection parent)
     : this(parent.rootWorkItem, parent)
 {
 }