示例#1
0
        public void RegisterComponent(IComponent component)
        {
            if (!Components.TryAdd(component.ComponentName, component))
            {
                // TODO: what should I do in this case?
                //Console.WriteLine($"Unable to register component '{component.ComponentName}' in page '{GetType().Name}'");
            }

            if (component is IHtmlAlert)
            {
                Alerts.Add(component as IHtmlAlert);
            }
            else if (component is IOverlay)
            {
                Overlays.Add(component as IOverlay);
            }
            else if (component is IProgressBar)
            {
                ProgressBars.Add(component as IProgressBar);
            }
        }
示例#2
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;
            }
        }