Example #1
0
        public void GuessActiveWidth()
        {
            var breakpoints = new List <double> {
                0, 100, 200, 300
            };

            Assert.AreEqual(-1, AdaptiveHelper.GuessActiveWidth(10, new List <double>()));
            Assert.AreEqual(0, AdaptiveHelper.GuessActiveWidth(10, breakpoints));
            Assert.AreEqual(100, AdaptiveHelper.GuessActiveWidth(150, breakpoints));
            Assert.AreEqual(200, AdaptiveHelper.GuessActiveWidth(250, breakpoints));
            Assert.AreEqual(300, AdaptiveHelper.GuessActiveWidth(350, breakpoints));
            Assert.AreEqual(300, AdaptiveHelper.GuessActiveWidth(1500, breakpoints));
        }
Example #2
0
        internal Element_ToastBinding ConvertToElement()
        {
            Element_ToastBinding binding = new(ToastTemplateType.ToastGeneric)
            {
                BaseUri       = BaseUri,
                AddImageQuery = AddImageQuery,
                Language      = Language
            };

            // Add children
            foreach (var child in Children)
            {
                var el = (IElement_ToastBindingChild)AdaptiveHelper.ConvertToElement(child);
                binding.Children.Add(el);
            }

            // Add attribution
            if (Attribution != null)
            {
                binding.Children.Add(Attribution.ConvertToElement());
            }

            // If there's hero, add it
            if (HeroImage != null)
            {
                binding.Children.Add(HeroImage.ConvertToElement());
            }

            // If there's app logo, add it
            if (AppLogoOverride != null)
            {
                binding.Children.Add(AppLogoOverride.ConvertToElement());
            }

            return(binding);
        }
    }
Example #3
0
 private static IElement_TileBindingChild ConvertToBindingChildElement(ITileBindingContentAdaptiveChild child)
 {
     return((IElement_TileBindingChild)AdaptiveHelper.ConvertToElement(child));
 }