Exemplo n.º 1
0
        public string GetHtmlToAppendByBrowserDropDown(BrowserDropDown dropDown)
        {
            string fontSettingsLabel = GetStylesToAppendByBrowserFont(dropDown.Label);
            string settingsLabel     = GetDefaultStyleSettings(dropDown.Label);
            string labelAnimations   = GetAnimationClass(dropDown.Label.AnimationType);

            string fontSettings     = GetStylesToAppendByBrowserFont(dropDown);
            string settings         = GetDefaultStyleSettings(dropDown);
            string animationClasses = GetAnimationClass(dropDown.AnimationType);

            string dropDownOptions = "";

            foreach (BrowserDropDownValue ddV in dropDown.Values)
            {
                dropDownOptions += $"<li id=\"{ddV.Id}\" class=\"{labelAnimations}\" style=\"{fontSettingsLabel}{settingsLabel}\"" +
                                   $"onclick=selectionChanged(\"{ddV.Id}\",\"{dropDown.Id}\") data-value=\"{ddV.HiddenValue}\">{ddV.Value}</li>"; //\"
            }

            string dd = "<div class=\"Wrapper\">" +
                        "<div class=\"selectorinio\" onclick=\"show();\">" +
                        $"<div id=\"{dropDown.Id}\" class=\"label {animationClasses}\" style=\"{settings}{fontSettings}\">{dropDown.Label.Text}</div>" +
                        "<b class=\"button\">▾</b></div>" +
                        "<div id=\"options\" class=\"hidden\">" +
                        "<ul>" + dropDownOptions + "</ul></div></div>";

            return(dd);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the selected profile for Firefox in a thread-safe manner
        /// </summary>
        /// <returns>Selected ProfilePath object</returns>
        public ProfilePath GetSelectedProfile()
        {
            ProfilePath selectedPath = null;

            BrowserDropDown.InvokeEx(f => selectedPath = (ProfilePath)BrowserDropDown.SelectedItem);

            return(selectedPath);
        }
Exemplo n.º 3
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("");
            }
        }
Exemplo n.º 4
0
        public void AddElement(BrowserElement element)
        {
            element.OrderIndex = AddedElements++;
            //element.Position = this.Position;
            switch (element.Type)
            {
            case BrowserElementType.BrowserBoxSelection:
                BrowserBoxSelection boxSelection = element as BrowserBoxSelection;

                break;

            case BrowserElementType.Button:
                BrowserButton button = element as BrowserButton;
                Buttons.Add(button);
                break;

            case BrowserElementType.Title:
                BrowserTitle title = element as BrowserTitle;
                Titles.Add(title);
                break;

            case BrowserElementType.Text:
                BrowserText text = element as BrowserText;
                Texts.Add(text);
                break;

            case BrowserElementType.TextBox:
                BrowserTextBox textBox = element as BrowserTextBox;
                TextBoxes.Add(textBox);
                break;

            case BrowserElementType.Card:
                BrowserCard card = element as BrowserCard;
                Cards.Add(card);
                break;

            case BrowserElementType.Password:
                BrowserPasswordTextBox passwordTextBox = element as BrowserPasswordTextBox;
                PasswordTextBoxes.Add(passwordTextBox);
                break;

            //case BrowserElementType.YesNoDialog:
            //    BrowserYesNoDialog yesNoDialog = element as BrowserYesNoDialog;
            //    YesNoDialog = yesNoDialog;
            //    break;
            case BrowserElementType.Checkbox:
                BrowserCheckBox checkBox = element as BrowserCheckBox;
                CheckBoxes.Add(checkBox);
                break;

            case BrowserElementType.DropDown:
                BrowserDropDown dropDown = element as BrowserDropDown;
                DropDowns.Add(dropDown);
                break;

            case BrowserElementType.ProgressBar:
                BrowserProgressBar progressBar = element as BrowserProgressBar;
                ProgressBars.Add(progressBar);
                break;

            case BrowserElementType.Container:
                BrowserContainer container = element as BrowserContainer;
                Container.Add(container);
                break;

            case BrowserElementType.Icon:
                BrowserButtonIcon icon = element as BrowserButtonIcon;
                Icons.Add(icon);
                break;

            default:
                NAPI.Util.ConsoleOutput($"UNKNOWN ELEMENT OF TYPE {element.Type}");
                break;
            }
        }