public List <ConsoleFlowResult> Run() { if (!registeredMethodsInAgent.Any()) { ConsoleWriter.WriteLine("Couldn't find any registered methods in the agent, which can be invoked", Color.Yellow); return(null); } var consoleFlow = new ConsoleWizard { IsStepCountVisible = true }; var agentSelectionPage = new ConsoleOptionsPage("Which method you want the message to be sent to ?", ConsoleColor.Cyan); registeredMethodsInAgent.ForEach(method => { agentSelectionPage.AddOption(method); }); var basicConfigurationPage = new ConsoleReadItemsPage(new List <ConsoleReadItem> { new ConsoleReadItem { Question = "Time in milliseconds between sends? :", ItemType = typeof(int), ValidationErrorMessage = "Please enter a numeric value" }, new ConsoleReadItem { Question = "Timeout in milliseconds? :", ItemType = typeof(int), ValidationErrorMessage = "Please enter a numeric value" } }, ConsoleColor.Cyan); consoleFlow.AddPage(agentSelectionPage); consoleFlow.AddPage(basicConfigurationPage); return(consoleFlow.Run()); }
public void Run() { ConsoleWriter.ShowMaximum(); ConsoleWriter.WriteLine("Welcome to SignalR Test Tool !!", Color.Yellow); ConsoleWriter.WriteLine(); ConsolePosition.MainMenuLastPosition = new Point(Console.CursorLeft, Console.CursorTop); var consoleFlow = new ConsoleWizard { CursorPositionChanged = OnCursorPositionChanged }; var menuSelectionPage = new ConsoleOptionsPage("What would you like to do ?", ConsoleColor.Cyan); menuSelectionPage.AddOption("Start a new load test"); menuSelectionPage.AddOption("Start sending message on an running load"); menuSelectionPage.AddOption("Stop the load test"); menuSelectionPage.AddOption("Stop sending message on an running load"); consoleFlow.AddPage(menuSelectionPage); menuSelectionPage.EnableOption(0); menuSelectionPage.DisableOption(1); menuSelectionPage.DisableOption(2); menuSelectionPage.DisableOption(3); MenuSelectedCommand command = null; do { ConsoleWriter.ClearConsole(ConsolePosition.MainMenuLastPosition.Y); ConsoleWriter.WriteLine(); var data = consoleFlow.Run(); var selecteIndex = data.GetMainMenuSelectedIndex(); if (selecteIndex == 0) { command = new MenuSelectedCommand(menuSelectionPage); } if (selecteIndex.HasValue) { command.Execute(selecteIndex.Value); } } while (true); }
public List <ConsoleFlowResult> Run() { var consoleFlow = new ConsoleWizard { IsStepCountVisible = true }; var basicConfigurationPage = new ConsoleReadItemsPage(new List <ConsoleReadItem> { new ConsoleReadItem { Question = "What is the target URL of Hub? :", Validator = TargetUrlValidator, ValidationErrorMessage = "Please enter a valid url" }, new ConsoleReadItem { Question = "what is the name of Hub? :" }, new ConsoleReadItem { Question = "How many connections you want to ramp up? :", ItemType = typeof(int), ValidationErrorMessage = "Please enter a numeric value" } }, ConsoleColor.Cyan); var agentSelectionPage = new ConsoleOptionsPage("Which of the below Agents should run the test?", ConsoleColor.Cyan); var agentList = AgentBuilder.GetAgentList(); agentList.ForEach(agent => agentSelectionPage.AddOption(agent)); agentSelectionPage.AddExitOption(); var transportSelectionPage = new ConsoleOptionsPage("Choose the transport mechanism?", ConsoleColor.Cyan); transportSelectionPage.AddOption("Websockets"); transportSelectionPage.AddOption("Long Polling"); transportSelectionPage.AddOption("Server Sent Events"); transportSelectionPage.AddOption("Auto"); var clientTypeSelectionPage = new ConsoleOptionsPage("Choose the client type?", ConsoleColor.Cyan); clientTypeSelectionPage.AddOption("SignalR"); clientTypeSelectionPage.AddOption("SignalR Core"); consoleFlow.AddPage(basicConfigurationPage); consoleFlow.AddPage(agentSelectionPage); consoleFlow.AddPage(transportSelectionPage); consoleFlow.AddPage(clientTypeSelectionPage); return(consoleFlow.Run()); }