private static void RunCli(Emulation emulation) { // emulation.GenIterationPerformed += () => Console.WriteLine("GenIterationPerformed"); emulation.StateChanged += state => Console.WriteLine(state); emulation.Init(); while (true) { var command = Console.ReadLine(); var result = false; switch (command) { case "start": result = emulation.Start(); break; case "pause": result = emulation.Pause(); break; case "continue": result = emulation.Continue(); break; case "restart": result = emulation.Restart(); break; case "q": return; } Console.WriteLine($"[{result}]"); } }
private void Start_Click(object sender, EventArgs e) { if (RepaintThread == null) { ICourier courier = GetCourier(); if (courier == null) { return; } List <Shop> shops = GetShops(); Coordinates min = new Coordinates(0, panel1.Height - 100); Coordinates max = new Coordinates(panel1.Width - 100, (int)(panel1.Height * 0.3)); Emulation = new Emulation(shops, courier, min, max); Emulation.Start(); RepaintThread = new Thread(PanelRepaint); RepaintThread.Start(); start.Text = "Stop"; } else { AllStop(); } }
private void StartEmulation_Clicked(object sender, RoutedEventArgs e) { emulation.Start(); ((MenuItem)sender).IsEnabled = false; }