Exemplo n.º 1
0
        /// <summary>
        ///   Called by the ASP.NET page framework to notify server controls that use
        ///   composition-based implementation to create any child controls they contain
        ///   in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            try
            {
                // Custom Font Path
                CustomFontPathTextBox = new TextBox {
                    ID = "txtCustomFont", CssClass = "umbEditorTextField"
                };

                // Fonts DropDownList
                FontNameDropDownList = new DropDownList {
                    ID = "ddlFontName", CssClass = "umbEditorDropDownList"
                };
                FontNameDropDownList.Items.AddRange(DropDownItems.Fonts);

                // Font Size TextBox
                FontSizeTextBox = new TextBox {
                    ID = "txtFontSize", CssClass = "umbEditorNumberField"
                };

                // Font Style CheckBoxList
                FontStyleCheckBoxList = new CheckBoxList
                {
                    ID = "cblFontStyle", RepeatColumns = 2, CssClass = "umbEditorDropDownList"
                };
                FontStyleCheckBoxList.Items.AddRange(DropDownItems.FontStyles);

                // Fore Color Picker
                ForegroundColorPicker = new HtmlInputText {
                    ID = "cpForeColor"
                };
                ForegroundColorPicker.Attributes.Add("type", "color");
                ForegroundColorPicker.Attributes.Add("data-hex", "true");

                // Back Color Picker
                BackgroundColorPicker = new HtmlInputText {
                    ID = "cpBackColor"
                };
                BackgroundColorPicker.Attributes.Add("type", "color");
                BackgroundColorPicker.Attributes.Add("data-hex", "true");

                // Shadow Color Picker
                ShadowColorPicker = new HtmlInputText {
                    ID = "cpShadowColor"
                };
                ShadowColorPicker.Attributes.Add("type", "color");
                ShadowColorPicker.Attributes.Add("data-hex", "true");

                // Horizontal Alignment DropDownList
                HorizontalAlignmentDropDownList = new DropDownList
                {
                    ID = "ddlAlignHorizontal", CssClass = "umbEditorDropDownList"
                };
                HorizontalAlignmentDropDownList.Items.AddRange(DropDownItems.HAlignments);

                // Vertical Alignment DropDownList
                VerticalAlignmentDropDownList = new DropDownList
                {
                    ID = "ddlAlignVertical", CssClass = "umbEditorDropDownList"
                };
                VerticalAlignmentDropDownList.Items.AddRange(DropDownItems.VAlignments);

                // Area Height TextBox
                ImageHeightTextBox = new TextBox {
                    ID = "txtImageHeight", CssClass = "umbEditorNumberField"
                };

                // Area Width TextBox
                ImageWidthTextBox = new TextBox {
                    ID = "txtImageWidth", CssClass = "umbEditorNumberField"
                };

                // Background picker
                _dataExtractor = new DataExtractor {
                    Value = BackgroundMediaId
                };
                BackgroundMediaChooser = new mediaChooser(_dataExtractor, true, true)
                {
                    ID = "backgroundMedia"
                };

                // Image Format Picker
                ImageFormatDropDownList = new DropDownList {
                    ID = "ddlImageFormat", CssClass = "umbEditorDropDownList"
                };
                ImageFormatDropDownList.Items.AddRange(DropDownItems.OutputFormats);

                // Preview Image
                ImagePreview = new Image
                {
                    BorderColor = Color.LightGray, BorderStyle = BorderStyle.Dashed, BorderWidth = 1
                };

                // Add Controls to Editor
                Controls.Add(FontNameDropDownList);
                Controls.Add(CustomFontPathTextBox);
                Controls.Add(FontSizeTextBox);
                Controls.Add(FontStyleCheckBoxList);
                Controls.Add(ForegroundColorPicker);
                Controls.Add(BackgroundColorPicker);
                Controls.Add(ShadowColorPicker);
                Controls.Add(HorizontalAlignmentDropDownList);
                Controls.Add(VerticalAlignmentDropDownList);
                Controls.Add(ImageHeightTextBox);
                Controls.Add(ImageWidthTextBox);
                Controls.Add(BackgroundMediaChooser);
                Controls.Add(ImageFormatDropDownList);
                Controls.Add(ImagePreview);
            }
            catch (Exception exception)
            {
                SetErrorMessage(exception);
            }
        }
        /// <summary>
        ///   Called by the ASP.NET page framework to notify server controls that use
        ///   composition-based implementation to create any child controls they contain 
        ///   in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            try
            {
                // Custom Font Path
                CustomFontPathTextBox = new TextBox {ID = "txtCustomFont", CssClass = "umbEditorTextField"};

                // Fonts DropDownList
                FontNameDropDownList = new DropDownList {ID = "ddlFontName", CssClass = "umbEditorDropDownList"};
                FontNameDropDownList.Items.AddRange(DropDownItems.Fonts);

                // Font Size TextBox
                FontSizeTextBox = new TextBox {ID = "txtFontSize", CssClass = "umbEditorNumberField"};

                // Font Style CheckBoxList
                FontStyleCheckBoxList = new CheckBoxList
                                            {ID = "cblFontStyle", RepeatColumns = 2, CssClass = "umbEditorDropDownList"};
                FontStyleCheckBoxList.Items.AddRange(DropDownItems.FontStyles);

                // Fore Color Picker
                ForegroundColorPicker = new HtmlInputText {ID = "cpForeColor"};
                ForegroundColorPicker.Attributes.Add("type", "color");
                ForegroundColorPicker.Attributes.Add("data-hex", "true");

                // Back Color Picker
                BackgroundColorPicker = new HtmlInputText {ID = "cpBackColor"};
                BackgroundColorPicker.Attributes.Add("type", "color");
                BackgroundColorPicker.Attributes.Add("data-hex", "true");

                // Shadow Color Picker
                ShadowColorPicker = new HtmlInputText {ID = "cpShadowColor"};
                ShadowColorPicker.Attributes.Add("type", "color");
                ShadowColorPicker.Attributes.Add("data-hex", "true");

                // Horizontal Alignment DropDownList
                HorizontalAlignmentDropDownList = new DropDownList
                                                      {ID = "ddlAlignHorizontal", CssClass = "umbEditorDropDownList"};
                HorizontalAlignmentDropDownList.Items.AddRange(DropDownItems.HAlignments);

                // Vertical Alignment DropDownList
                VerticalAlignmentDropDownList = new DropDownList
                                                    {ID = "ddlAlignVertical", CssClass = "umbEditorDropDownList"};
                VerticalAlignmentDropDownList.Items.AddRange(DropDownItems.VAlignments);

                // Area Height TextBox
                ImageHeightTextBox = new TextBox {ID = "txtImageHeight", CssClass = "umbEditorNumberField"};

                // Area Width TextBox
                ImageWidthTextBox = new TextBox {ID = "txtImageWidth", CssClass = "umbEditorNumberField"};

                // Background picker
                _dataExtractor = new DataExtractor {Value = BackgroundMediaId};
                BackgroundMediaChooser = new mediaChooser(_dataExtractor, true, true) {ID = "backgroundMedia"};

                // Image Format Picker
                ImageFormatDropDownList = new DropDownList {ID = "ddlImageFormat", CssClass = "umbEditorDropDownList"};
                ImageFormatDropDownList.Items.AddRange(DropDownItems.OutputFormats);

                // Preview Image
                ImagePreview = new Image
                                   {BorderColor = Color.LightGray, BorderStyle = BorderStyle.Dashed, BorderWidth = 1};

                // Add Controls to Editor
                Controls.Add(FontNameDropDownList);
                Controls.Add(CustomFontPathTextBox);
                Controls.Add(FontSizeTextBox);
                Controls.Add(FontStyleCheckBoxList);
                Controls.Add(ForegroundColorPicker);
                Controls.Add(BackgroundColorPicker);
                Controls.Add(ShadowColorPicker);
                Controls.Add(HorizontalAlignmentDropDownList);
                Controls.Add(VerticalAlignmentDropDownList);
                Controls.Add(ImageHeightTextBox);
                Controls.Add(ImageWidthTextBox);
                Controls.Add(BackgroundMediaChooser);
                Controls.Add(ImageFormatDropDownList);
                Controls.Add(ImagePreview);
            }
            catch (Exception exception)
            {
                SetErrorMessage(exception);
            }
        }