public void StartEventLoop() { while (true) { var key = Console.ReadKey(); Console.WriteLine(); switch (key.Key) { case ConsoleKey.A: var addAppCommand = new AddNewApplicationCommand { AccountId = 1, ApplicationType = 1, Description = "New Desktop Application" }; _bus.Send(new Address("Playground.Service", "DESKTOP-883BG27"), addAppCommand); Console.WriteLine($"Sent AddNewApplicationCommand."); continue; case ConsoleKey.B: var addNewWebAppCommand = new AddNewApplicationCommand { AccountId = 1, ApplicationType = 2, Description = "New Web Application" }; _bus.Send(new Address("Playground.Service", "DESKTOP-883BG27"), addNewWebAppCommand); Console.WriteLine($"Sent AddNewApplicationCommand"); continue; case ConsoleKey.C: var addNewMobileAppCommand = new AddNewApplicationCommand { AccountId = 1, ApplicationType = 3, Description = "New Mobile Application" }; _bus.Send(new Address("Playground.Service", "DESKTOP-883BG27"), addNewMobileAppCommand); Console.WriteLine($"Sent AddNewApplicationCommand"); continue; default: return; } } }
public static Application Convert(this AddNewApplicationCommand source) { if (source == null) { return(null); } return(new Application { AccountId = source.AccountId, Description = source.Description, Type = (Definitions.ApplicationType)source.ApplicationType }); }