Beispiel #1
0
        private void LoadSlotInfoMap(ContentTypeManager contentTypeManager,
                                     TemplateNameManager templateNameManager)
        {
            PSTemplateSlot[] slotData = PSWSUtils.LoadSlots(_assemblyService);

            _slotMap = new Dictionary <string, SlotInfo>();
            foreach (PSTemplateSlot slot in slotData)
            {
                SlotInfo info = new SlotInfo(slot.name, new PercussionGuid(slot.id));
                foreach (PSTemplateSlotContent idPair in slot.AllowedContent)
                {
                    PercussionGuid            contentTypeID   = new PercussionGuid(idPair.contentTypeId);
                    PercussionGuid            templateID      = new PercussionGuid(idPair.templateId);
                    string                    contentTypeName = contentTypeManager[contentTypeID];
                    string                    templateName    = templateNameManager[templateID];
                    ContentTypeToTemplateInfo pairData
                        = new ContentTypeToTemplateInfo(contentTypeName, contentTypeID, templateName, templateID);
                    info.AllowedContentTemplatePairs.Add(pairData);
                }

                if (!_slotMap.ContainsKey(slot.name))
                {
                    _slotMap.Add(slot.name, info);
                }
            }
        }
Beispiel #2
0
        internal SlotManager(assemblySOAP assemblyService,
                             ContentTypeManager contentTypeManager,
                             TemplateNameManager templateNameManager)
        {
            _assemblyService = assemblyService;

            if (_slotMap == null)
            {
                // Lock the container for possible updating.
                lock (lockObject)
                {
                    // Was the map loaded while we waited for the lock?
                    if (_slotMap == null)
                    {
                        LoadSlotInfoMap(contentTypeManager, templateNameManager);
                    }
                }
            }
        }