static void Main(string[] args) { bool exitProgram = false; IUiMessageFactory uiMessageFactory = new UiMessageFactory(); IGameService gameService = new GameService(); IStatisticsService statsService = new StatisticsService(); while (!exitProgram) { Console.Clear(); uiMessageFactory.WelcomeMessage(); if (Console.ReadKey().Key == ConsoleKey.D1) { statsService.Begin(); } if (Console.ReadKey().Key == ConsoleKey.D2) { gameService.Begin(); } if (Console.ReadKey().Key == ConsoleKey.Escape) { exitProgram = true; } } }
static void Main(string[] args) { IUiMessageFactory messageFactory = new UiMessageFactory(); var welcomeChoice = messageFactory.WelcomeMessage(); if (welcomeChoice == choiceZaidimas) { IGameService gameService = new GameService(); gameService.Begin(); } if (welcomeChoice == choiceStatistika) { IStatisticService service = new StatisticsService(); service.Begin(); } }
static void Main(string[] args) { using (var ctx = new HangmanContext()) { IUiMassageFactory massageFactory = new UiMassageFactory(); var welcomeChoice = massageFactory.WelcomeMessage(); if (welcomeChoice == choiceZaidimas) { IGameService gameService = new GameService(); gameService.Begin(); } if (welcomeChoice == choiceStatistika) { IStatisticsService service = new StatisticsService(); service.Begin(); } } }