예제 #1
0
        public string GetHtmlToAppendByBrowserProgressBar(BrowserProgressbar progressBar)
        {
            string styles       = GetStylesToAppendByBrowserFont(progressBar);
            string defaultStyle = GetDefaultStyleSettings(progressBar, excludeWidthAndHeight: true);
            string animations   = GetAnimationClass(progressBar.AnimationType);

            string progressValue = "";

            if (progressBar.ShowCurrentValue)
            {
                progressValue = progressBar.CurrentValue + "%";
            }


            return($"<div class=\"progress {GetContentAlignment(progressBar.ItemInlineAlignment)}\" style=\"{styles}{defaultStyle}width:{progressBar.Width};height:{progressBar.Height};\" class=\"{animations}\"><div id=\"{progressBar.Id}\" class=\"progress-bar {progressBar.StyleClass}\" role=\"progressbar\" style=\"{defaultStyle}{styles}width: {progressBar.CurrentValue}%\" aria-valuenow=\"{progressBar.CurrentValue}\" aria-valuemin=\"{progressBar.MinValue}\" aria-valuemax=\"{progressBar.MaxValue}\">{progressValue}</div></div>");
        }
예제 #2
0
        public string GetHtmlStringByBrowserElement(IBrowserElement element)
        {
            try
            {
                StringBuilder rawHtmlBuilder = new StringBuilder();
                switch (element.Type)
                {
                case BrowserElementType.Card:
                    BrowserCard card = element as BrowserCard;
                    switch (card.CardType)
                    {
                    case BrowserCardType.HeaderDescriptionAndButtonWithIcon:
                        string cardHtml2 = GetHtmlToAppendByBrowserCard(card);
                        rawHtmlBuilder.Append(cardHtml2);
                        break;

                    default:
                        string cardHtml3 = GetHtmlToAppendByBrowserCard(card);
                        rawHtmlBuilder.Append(cardHtml3);
                        break;
                    }
                    break;

                case BrowserElementType.BrowserBoxSelection:
                    // Not implemented yet
                    BrowserBoxSelection boxSelection = element as BrowserBoxSelection;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserBoxSelection(boxSelection));
                    break;

                case BrowserElementType.Title:
                    BrowserTitle titleElement = element as BrowserTitle;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserTitle(titleElement));
                    break;

                case BrowserElementType.Text:
                    BrowserText textElement = element as BrowserText;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserTextElement(textElement));
                    break;

                case BrowserElementType.Checkbox:
                    BrowserCheckBox checkBoxElement = element as BrowserCheckBox;
                    rawHtmlBuilder.Append(GetHtmlToAppendByCheckBox(checkBoxElement));
                    break;

                case BrowserElementType.Button:
                    BrowserButton browserButton = element as BrowserButton;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserButton(browserButton));
                    break;

                case BrowserElementType.TextBox:
                    BrowserTextBox browserTextBox = element as BrowserTextBox;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserTextBox(browserTextBox));
                    break;

                case BrowserElementType.Password:
                    BrowserPasswordTextBox browserPasswordTextBox = element as BrowserPasswordTextBox;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserPasswordTextBox(browserPasswordTextBox));
                    break;

                case BrowserElementType.DropDown:
                    BrowserDropDown dropDown = element as BrowserDropDown;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserDropDown(dropDown));
                    break;

                case BrowserElementType.ProgressBar:
                    BrowserProgressbar progressBar = element as BrowserProgressbar;
                    rawHtmlBuilder.Append(GetHtmlToAppendByBrowserProgressBar(progressBar));
                    break;

                case BrowserElementType.Icon:
                    BrowserButtonIcon icon = element as BrowserButtonIcon;
                    rawHtmlBuilder.Append(GetHtmlToAppendByIcon(icon));
                    break;
                }

                return(rawHtmlBuilder.ToString());
            }
            catch (Exception e)
            {
                ProvideError(e);
                return("");
            }
        }