Exemple #1
0
 /// <summary>
 /// Create new instance of the model
 /// </summary>
 /// <param name="resources">List of localized resources</param>
 /// <param name="languages">What languages are supported</param>
 /// <param name="popupTitleLength">How many symbols are possible to show in the modal title bar</param>
 /// <param name="listDisplayLength">How many of resource key will be visible in the list</param>
 /// <param name="options">What kind of options should be taken into account while generating the results</param>
 public LocalizationResourceApiTreeModel(
     List <LocalizationResource> resources,
     IEnumerable <CultureInfo> languages,
     int popupTitleLength,
     int listDisplayLength,
     UiOptions options) : base(languages)
 {
     _popupTitleLength  = popupTitleLength;
     _listDisplayLength = listDisplayLength;
     Resources          = ConvertToApiModel(resources);
     Options            = options;
 }
        /// <summary>
        /// Create new instance of the model
        /// </summary>
        /// <param name="resources">List of localized resources</param>
        /// <param name="languages">What languages are supported</param>
        /// <param name="popupTitleLength">How many symbols are possible to show in the modal title bar</param>
        /// <param name="listDisplayLength">How many of resource key will be visible in the list</param>
        /// <param name="options">What kind of options should be taken into account while generating the results</param>
        public LocalizationResourceApiModel(
            ICollection <LocalizationResource> resources,
            IEnumerable <CultureInfo> languages,
            int popupTitleLength,
            int listDisplayLength,
            UiOptions options) : base(languages)
        {
            if (resources == null)
            {
                throw new ArgumentNullException(nameof(resources));
            }
            if (languages == null)
            {
                throw new ArgumentNullException(nameof(languages));
            }

            _popupTitleLength  = popupTitleLength;
            _listDisplayLength = listDisplayLength;
            Resources          = resources.Select(r => ConvertToApiModel(r, languages)).ToList();
            Options            = options;
        }