protected override bool SelectValueTypeImpl(string prompt, Type paramType, object initialValue, out object chosen) { var dlg = new ConsoleGuiTextDialog(prompt, initialValue?.ToString()); if (dlg.ShowDialog()) { chosen = dlg.ResultText; return(true); } chosen = null; return(false); }
public override bool TypeText(string header, string prompt, int maxLength, string initialText, out string text, bool requireSaneHeaderText) { var dlg = new ConsoleGuiTextDialog(prompt, initialText); if (dlg.ShowDialog()) { text = dlg.ResultText; return(true); } text = null; return(false); }
protected override bool SelectValueTypeImpl(DialogArgs args, Type paramType, object initialValue, out object chosen) { var dlg = new ConsoleGuiTextDialog(args, initialValue?.ToString()); if (dlg.ShowDialog()) { if (string.IsNullOrWhiteSpace(dlg.ResultText) || dlg.ResultText.Equals("null", StringComparison.CurrentCultureIgnoreCase)) { chosen = null; } else { var wrappedType = Nullable.GetUnderlyingType(paramType); chosen = Convert.ChangeType(dlg.ResultText, wrappedType ?? paramType); } return(true); } chosen = null; return(false); }