/// <summary> /// Reads a line of text from the console. This is a virtual function so that subclasses /// can support other kinds of views. /// </summary> /// <returns>The string, or the default value if the user pressed the Return key.</returns> protected virtual string InputWithDefault() { string line = this.Input(); if (string.IsNullOrEmpty(line) && this.SBSFormField.DefaultValue != null) { line = StringSubstitutor.SubstituteVariablesInExpression(this.SBSFormField.DefaultValue.ToString()); } return(line); }
public virtual void Render() { if (!this.CanDisplay) { return; } string sDefault = SBSFormField.DefaultValue != null ? $"({SBSFormField.DefaultValue.ToString()})" : ""; sDefault = StringSubstitutor.SubstituteVariablesInExpression(sDefault); string prompt = this.SBSFormField.Prompt; if (prompt != null && prompt.StartsWith("$html:")) { prompt = prompt.Replace("$html:", ""); prompt = HtmlRemoval.StripTagsRegex(prompt); } this.ColoredOutput($"({this.SBSFormField.FieldTypeName}) {prompt}: {sDefault}", ConsoleColor.Cyan); }