Пример #1
0
        //public MediaObjectHtmlBuilder(UserController userController, HtmlController htmlController, UrlController urlController)
        //{
        //    _userController = userController;
        //    _htmlController = htmlController;
        //    _urlController = urlController;
        //}

        /// <summary>
        /// Initializes a new instance of the <see cref="MediaObjectHtmlBuilder"/> class.
        /// </summary>
        /// <param name="options">The options that will dictate the HTML and URL generation.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="options" /> is null.</exception>
        /// <exception cref="System.ArgumentException">Thrown when <paramref name="options" /> contains one or more
        /// invalid values.</exception>
        public MediaObjectHtmlBuilder(MediaObjectHtmlBuilderOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if ((options.Browsers == null) || (options.Browsers.Length < 1))
            {
                throw new ArgumentException("Argument Exception: A valid list of browsers must be passed to the MediaObjectHtmlBuilder constructor. The value passed was either null or contained zero elements. Typically this property is supplied by calling Utils.GetBrowserIdsForCurrentRequest().");
            }

            if (options.GalleryObject == null)
            {
                throw new ArgumentException("The GalleryObject property of the options parameter cannot be null.", nameof(options));
            }

            if (options.DisplayType == DisplayObjectType.Unknown)
            {
                throw new ArgumentException("The DisplayType property of the options parameter cannot be DisplayObjectType.Unknown.", nameof(options));
            }

            Options = options;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaObjectHtmlBuilder"/> class.
        /// </summary>
        /// <param name="options">The options that will dictate the HTML and URL generation.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="options" /> is null.</exception>
        /// <exception cref="System.ArgumentException">Thrown when <paramref name="options" /> contains one or more
        /// invalid values.</exception>
        public MediaObjectHtmlBuilder(MediaObjectHtmlBuilderOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if ((options.Browsers == null) || (options.Browsers.Length < 1))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.GalleryServer.MediaObjectHtmlBuilder_Ctor_InvalidBrowsers_Msg));
            }

            if (options.GalleryObject == null)
            {
                throw new ArgumentException("The GalleryObject property of the options parameter cannot be null.", "options");
            }

            if (options.DisplayType == DisplayObjectType.Unknown)
            {
                throw new ArgumentException("The DisplayType property of the options parameter cannot be DisplayObjectType.Unknown.", "options");
            }

            Options = options;
        }