diff --git a/quiz-console-app/Helpers/QuestionShuffler.cs b/quiz-console-app/Helpers/QuestionShuffler.cs index 88cf1ff..e14ef72 100644 --- a/quiz-console-app/Helpers/QuestionShuffler.cs +++ b/quiz-console-app/Helpers/QuestionShuffler.cs @@ -17,7 +17,6 @@ public static void ShuffleBookletQuestions(BookletViewModel booklet) booklet.Questions = booklet.Questions.OrderBy(q => random.Next()).ToList(); } - public static List ShuffleQuestionOptions(List questions) { diff --git a/quiz-console-app/Models/MenuManager.cs b/quiz-console-app/Models/MenuManager.cs index 9326d50..1e9e162 100644 --- a/quiz-console-app/Models/MenuManager.cs +++ b/quiz-console-app/Models/MenuManager.cs @@ -13,20 +13,23 @@ public MenuManager() ErrorMessage = "Geçersiz seçim. Lütfen geçerli bir seçenek girin."; } - public void AddMenuOption(MenuOption option) - { - menuOptions[option.Id] = option; - } + public void AddMenuOption(MenuOption option) => menuOptions[option.Id] = option; + public void AddMenuOptions(MenuOption[] options) { foreach (MenuOption option in options) - { AddMenuOption(option); - } } - public void DisplayMenu() + public void ExecuteMenu() + { + DisplayMenu(); + HandleSelection(); + } + + + private void DisplayMenu() { for (int i = 0; i < menuOptions.Count; i++) { @@ -48,7 +51,7 @@ public void DisplayMenu() } } - public void HandleSelection() + private void HandleSelection() { bool menuState = true; @@ -73,5 +76,6 @@ public void HandleSelection() ConsoleHelper.WriteColored("Çıkış için enter tuşuna basın.", ConsoleColors.Debug); Console.ReadLine(); } + } diff --git a/quiz-console-app/Screens/ExportDataScreen.cs b/quiz-console-app/Screens/ExportDataScreen.cs index 39bfc3c..693676d 100644 --- a/quiz-console-app/Screens/ExportDataScreen.cs +++ b/quiz-console-app/Screens/ExportDataScreen.cs @@ -1,6 +1,5 @@ using quiz_console_app.Constants; using quiz_console_app.Models; -using quiz_console_app.Services; namespace quiz_console_app.Screens; @@ -10,8 +9,7 @@ public void DisplayMenuOptions() { MenuManager menuManager = new MenuManager(); menuManager.AddMenuOptions(MenuOptions.ExportOptions); - menuManager.DisplayMenu(); - menuManager.HandleSelection(); + menuManager.ExecuteMenu(); } diff --git a/quiz-console-app/Screens/QuizMainMenuScreen.cs b/quiz-console-app/Screens/QuizMainMenuScreen.cs index 049dbe6..e55a0b3 100644 --- a/quiz-console-app/Screens/QuizMainMenuScreen.cs +++ b/quiz-console-app/Screens/QuizMainMenuScreen.cs @@ -9,7 +9,6 @@ public void Show() { MenuManager menuManager = new MenuManager(); menuManager.AddMenuOptions(MenuOptions.GeneralOptions); - menuManager.DisplayMenu(); - menuManager.HandleSelection(); + menuManager.ExecuteMenu(); } } \ No newline at end of file