public MainForm(StreetDescription streets, IEnumerable <Intersection> intersections, IEnumerable <Car> cars) { _streets = streets; _intersections = intersections; _cars = cars; InitializeComponent(); Paint += OnPaint; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var streets = new StreetDescription(horizontalRoads: new int[] { 200, 500, 600 }, verticalRoads: new int[] { 200, 300, 400, 600, 800 }); var intersections = new IntersectionCollection(streets.Intersections); var carCollection = new CarCollection(); var form = new MainForm(streets, intersections, carCollection); var injector = new CarInjector(); var deleter = new CarDeleter(); var simulator = new Simulator(streets, intersections, carCollection, injector, deleter); Task.Run(() => MainLoop(form, simulator)); Application.Run(form); }