Beispiel #1
0
        /// <summary>
        /// Registers resource reference.
        /// </summary>
        /// <param name="register">The register.</param>
        /// <param name="resourceKey">The resource key.</param>
        /// <param name="throwException">if set to <c>true</c> [throw exception].</param>
        /// <param name="tagName">Name of the tag.</param>
        /// <param name="attribbutes">The attribbutes.</param>
        /// <returns></returns>
        private static MvcHtmlString RegisterResource(ResourceRegister register, string resourceKey, bool throwException, string tagName, KeyValuePair <string, string>[] attribbutes)
        {
            string        output;
            MvcHtmlString result;

            if (throwException)
            {
                register.RegisterResource(resourceKey);
                output = ResourceHelper.GenerateTag(tagName, attribbutes);
                result = new MvcHtmlString(output);
            }
            else if (register.TryRegisterResource(resourceKey))
            {
                output = ResourceHelper.GenerateTag(tagName, attribbutes);
                result = new MvcHtmlString(output);
            }
            else
            {
                result = MvcHtmlString.Empty;
            }

            return(result);
        }