コード例 #1
0
        internal static CarouselTemplate Convert(ICarouselTemplate template)
        {
            if (!(template is CarouselTemplate carouselTemplate))
            {
                carouselTemplate = new CarouselTemplate();
            }

            if (template.Columns == null)
            {
                throw new InvalidOperationException("The columns cannot be null.");
            }

            carouselTemplate.Columns = CarouselColumn.Convert(template.Columns);

            return(carouselTemplate);
        }
コード例 #2
0
        public static CarouselTemplate ToCarouselTemplate(this ICarouselTemplate self)
        {
            CarouselTemplate carouselTemplate = self as CarouselTemplate;

            if (carouselTemplate == null)
            {
                carouselTemplate = new CarouselTemplate();
            }

            if (self.Columns == null)
            {
                throw new InvalidOperationException("The columns cannot be null.");
            }

            carouselTemplate.Columns = self.Columns.ToCarouselColumn().ToArray();

            return(carouselTemplate);
        }
コード例 #3
0
        private static ITemplate Convert(ITemplate template)
        {
            switch (template)
            {
            case IButtonsTemplate buttonsTemplate:
                return(ButtonsTemplate.Convert(buttonsTemplate));

            case IConfirmTemplate confirmTemplate:
                return(ConfirmTemplate.Convert(confirmTemplate));

            case ICarouselTemplate carouselTemplate:
                return(CarouselTemplate.Convert(carouselTemplate));

            case IImageCarouselTemplate imageCarouselTemplate:
                return(ImageCarouselTemplate.Convert(imageCarouselTemplate));

            default:
                throw new NotSupportedException("Invalid template type.");
            }
        }