public string GetHtmlToAppendByIcon(BrowserButtonIcon icon) { string fontSettings = GetStylesToAppendByBrowserFont(icon); string defaultSettings = GetDefaultStyleSettings(icon); string animationClasses = GetAnimationClass(icon.AnimationType); OnClickReturn onClickEvent = new OnClickReturn() { RemoteEvent = icon.RemoteEvent, ReturnValues = icon.ReturnObjects, Id = icon.Id }; string enabled = icon.Enabled ? $"onclick = btnClickEventByElement([{ JsonConvert.SerializeObject(onClickEvent)}])" : "disabled"; return($"<i title=\"{icon.Text}\" style=\"{defaultSettings}\" class=\"{icon.StyleClass} {animationClasses}\"" + $"{enabled}></i>"); }
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(""); } }
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; } }