private void EscapeKeyHandler(ConsoleKeyInfo escape)
{
var consolePageApp = (Application as ConsolePageApp);
if (PageStack.GetSegments(PageStack.CurrentPath).Length > 1)
{
PageStack.TryUp();
}
else if(consolePageApp.AllowEscapeToExit && consolePageApp.PromptBeforeExit)
{
Dialog.ShowMessage("Are you sure you want to quit?".ToConsoleString(), (choice) =>
{
if(choice != null && choice.DisplayText == "Yes")
{
Application.Stop();
}
}, true, 10, new DialogButton() { DisplayText = "Yes" }, new DialogButton() { DisplayText = "No" });
}
else if(consolePageApp.AllowEscapeToExit)
{
Application.Stop();
}
}