/// <summary>
        /// Gets the template definition
        /// </summary>
        public AppletTemplateDefinition GetTemplateDefinition(String templateMnemonic)
        {
            AppletTemplateDefinition retVal = null;

            templateMnemonic = templateMnemonic.ToLowerInvariant();
            if (!s_templateCache.TryGetValue(templateMnemonic ?? "", out retVal))
            {
                retVal = this.m_appletManifest
                         .SelectMany(o => o.Templates)
                         .GroupBy(o => o.Mnemonic)
                         .Select(o => o.OrderByDescending(t => t.Priority).FirstOrDefault())
                         .FirstOrDefault(o => o.Mnemonic.ToLowerInvariant() == templateMnemonic);
                s_templateCache.TryAdd(templateMnemonic, retVal);
            }
            return(retVal);
        }
Example #2
0
        /// <summary>
        /// Gets the template definition
        /// </summary>
        public AppletTemplateDefinition GetTemplateDefinition(String templateMnemonic)
        {
            AppletTemplateDefinition retVal = null;

            templateMnemonic = templateMnemonic.ToLowerInvariant();
            if (!s_templateCache.TryGetValue(templateMnemonic ?? "", out retVal))
            {
                lock (s_syncLock)
                {
                    retVal = this.m_appletManifest.SelectMany(o => o.Templates).
                             FirstOrDefault(o => o.Mnemonic.ToLowerInvariant() == templateMnemonic);
                    if (retVal != null)
                    {
                        retVal.DefinitionContent = this.RenderAssetContent(this.ResolveAsset(retVal.Definition));
                    }
                    s_templateCache.Add(templateMnemonic, retVal);
                }
            }
            return(retVal);
        }