public async Task RunAsync(ChoiceCallback callback = null) { int idx = -1; do { Prompt prompt = new Prompt(Title, true); foreach (Option option in Options) { prompt.Add(option.BuildMessage(), option.Color); } prompt.Add(_goBackMessage, RenderOptions.SubnoteColor); try { idx = prompt.Run(); if (idx >= 0 && idx < Options.Count) { await Task.Run(() => Options[idx].Action.Invoke()); if (callback != null) { await callback(idx); } idx = -1; } else if (idx == Options.Count) { idx = int.MaxValue; } else if (idx == Consoul.EscapeIndex) { GoBack(); } } catch (Exception ex) { Consoul.Write($"{Title}[{idx}]\t{ex.Message}\r\n\tStack Trace: {ex.StackTrace}", RenderOptions.InvalidColor); if (RenderOptions.WaitOnError) { Consoul.Wait(); } } } while (idx < 0 && !GoBackRequested); }