A simple POCO that represent a variation label
Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheVariationLabel"/> class.
 /// </summary>
 /// <param name="variationLabel">The variation label.</param>
 public VariationLabelInfo(VariationLabel variationLabel)
 {
     this.FlagControlDisplayName = variationLabel.DisplayName;
     this.IsSource = variationLabel.IsSource;
     this.Language = variationLabel.Language;
     this.Locale = TryParse(variationLabel);
     this.Title = variationLabel.Title;
     this.TopWebUrl = new Uri(variationLabel.TopWebUrl);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CacheVariationLabel"/> class.
 /// </summary>
 /// <param name="variationLabel">The variation label.</param>
 public VariationLabelInfo(VariationLabel variationLabel) : this()
 {
     this.Title = variationLabel.Title;
     this.DisplayName = variationLabel.DisplayName;
     this.IsSource = variationLabel.IsSource;
     this.Language = TryParseCulture(variationLabel.Language);
     this.Locale = TryParseCulture(variationLabel.Locale);
     this.TopWebUrl = new Uri(variationLabel.TopWebUrl);
 }
Ejemplo n.º 3
0
        private static int TryParse(VariationLabel variationLabel)
        {
            int number;
            var result = int.TryParse(variationLabel.Locale, out number);

            // If the locale is not parsable, we use the Language property.
            if (result)
            {
                return number;
            }
            else
            {
                return new CultureInfo(variationLabel.Language).LCID;
            }
        }