/// <summary> /// Generate message box HTML and set to data collector /// </summary> /// <param name="text">Text of a message box</param> /// <param name="status">Status of a message box</param> /// <param name="title">Title of a message box</param> public void Show(string?text, MessageBoxStatus status = MessageBoxStatus.Error, string?title = null) { if (string.IsNullOrEmpty(text)) { throw new ArgumentNullException(nameof(text)); } var templateFile = MessageBoxTemplatesPath; switch (status) { case MessageBoxStatus.Information: templateFile += "InfoMessageBox.tpl"; break; case MessageBoxStatus.Error: templateFile += "ErrorMessageBox.tpl"; break; case MessageBoxStatus.Ok: templateFile += "OkMessageBox.tpl"; break; } var tpl = _templateFactory.Load(templateFile); tpl.Set("Message", text); tpl.Set("Title", string.IsNullOrEmpty(title) ? _stringTable.GetItem("FormTitleMessageBox") : title); _dataCollector.Add(tpl.Get()); _dataCollector.AddTitle(string.IsNullOrEmpty(title) ? _stringTable.GetItem("FormTitleMessageBox") : title); }
private void SetSiteTitleFromStringTable(string?currentPath, IStringTable stringTable) { var siteTitle = stringTable.GetItem(SiteTitleStringTableVariableName); if (string.IsNullOrEmpty(siteTitle)) { return; } if (string.IsNullOrEmpty(currentPath) || currentPath == "/" || currentPath !.StartsWith("/?") || !_dataCollector.IsDataExist(_dataCollector.TitleVariableName)) { _dataCollector.Add(_dataCollector.TitleVariableName, siteTitle); }
public string GenerateDefaultListItem(bool isSelected = true) { return(string.Format("<option value=''{1}>{0}</option>", _stringTable.GetItem("HtmlListDefaultItemLabel"), isSelected ? " selected='selected'" : "")); }
/// <summary> /// Set template variable value from StringTable (all occurrences will be replaced) /// </summary> /// <param name="variableName">Variable name in master template file</param> /// <param name="stringTableKey">StringTable key</param> public void AddSt(string variableName, string stringTableKey) { Add(variableName, _stringTable.GetItem(stringTableKey)); }
private void SetSiteTitleFromStringTable(string currentPath, IStringTable stringTable) { var siteTitle = stringTable.GetItem(SiteTitleStringTableVariableName); if (string.IsNullOrEmpty(siteTitle)) return; if (string.IsNullOrEmpty(currentPath) || currentPath == "/" || currentPath.StartsWith("/?") || !_dataCollector.IsDataExist(_dataCollector.TitleVariableName)) _dataCollector.Add(_dataCollector.TitleVariableName, siteTitle); else _dataCollector.Add(_dataCollector.TitleVariableName, " - " + siteTitle); }