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); }
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); }
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."); } }