Пример #1
0
        public static BaseContent GetContentObject(object contentOwner)
        {
            BaseContent contentObj = null;

            if (contentOwner is TextSection)
            {
                contentObj = new TextSectionContent();
            }
            else if (contentOwner is ImageSection)
            {
                contentObj = new ImageSectionContent();
            }
            else if (contentOwner is AudioSection || contentOwner is VideoSection || contentOwner is EmbeddedHtmlSection || contentOwner is GifSection)
            {
                contentObj = new TitleCaptionSectionContent();
            }
            else if (contentOwner is ChatNode)
            {
                contentObj = new NodeContent();
            }
            else if (contentOwner is Button)
            {
                contentObj = new ButtonContent();
            }
            return(contentObj);
        }
Пример #2
0
        public static BaseContent GetContentObjectV2(object contentOwner)
        {
            BaseContent contentObj = null;

            if (contentOwner is Section sec)
            {
                switch (sec.SectionType)
                {
                case SectionTypeEnum.Image:
                    contentObj = new ImageSectionContent();
                    break;

                case SectionTypeEnum.Text:
                    contentObj = new TextSectionContent();
                    break;

                default:
                    contentObj = new TitleCaptionSectionContent();
                    break;
                }
            }
            else if (contentOwner is ChatNode)
            {
                contentObj = new NodeContent();
            }
            else if (contentOwner is Button)
            {
                contentObj = new ButtonContent();
            }
            return(contentObj);
        }