public ParallelAlgorithmController(List <AlgorithmForm> algoForms, PlanForm planWindow) { algorithmForms = algoForms; planForm = planWindow; AttachEvents(); // TODO: Почему-то если подписаться здесь ParallelAlgorithm.GetInstance().Loaded, то требует, чтобы этот класс тоже был сериализуемым }
public void Init() { //Plan plan = new Plan(); // Создаем окна алгоритмов algorithmForms = new List <AlgorithmForm>(); for (int i = 0; i < Utilities.GetInstance().TANKS_COUNT; i++) { AlgorithmForm algorithmForm = new AlgorithmForm(); algorithmForm.dgvAlgorithm.Tag = i; algorithmForm.MdiParent = this; algorithmForm.Text = worldController.world.tanks[i].ToString(); algorithmForm.Show(); algorithmForms.Add(algorithmForm); algorithmsToolStripMenuItem.DropDownItems.Add(worldController.world.tanks[i].ToString(), null, new EventHandler((sender, e) => { OpenAlgorithmForm(algorithmForm); })); // Устанавливаем значения танка в индикаторах InitIndicators(i, algorithmForm); } //Создаем окно с планом planForm = new PlanForm(); for (int i = 0; i < Utilities.GetInstance().TANKS_COUNT; i++) { planForm.dgvPlan.Columns.Add(worldController.world.tanks[i].ToString(), worldController.world.tanks[i].ToString()); } planForm.MdiParent = this; //foreach (var item in plan.ints) //{ // planForm.dgvPlan.Rows.Add(item.Item1, item.Item2, item.Item3); //} planForm.Show(); algorithmController = new ParallelAlgorithmController(algorithmForms, planForm); // Задаем параметры формы, в которой будет выводится графика SFML sfmlForm = new Form(); sfmlForm.MdiParent = this; sfmlForm.Text = $"Ветер - {worldController.GetWind().ToString()}"; sfmlForm.MaximizeBox = false; sfmlForm.ClientSize = new Size((int)(Utilities.GetInstance().TILE_SIZE *Utilities.GetInstance().WIDTH_TILE_COUNT), (int)(Utilities.GetInstance().TILE_SIZE *Utilities.GetInstance().HEIGHT_TILE_COUNT)); sfmlForm.MinimumSize = sfmlForm.Size; sfmlForm.Show(); // Создаем surface на форме для рисования через контекст SFML DrawingSurface surface = new DrawingSurface(); surface.Size = new Size((int)(Utilities.GetInstance().TILE_SIZE *Utilities.GetInstance().WIDTH_TILE_COUNT), (int)(Utilities.GetInstance().TILE_SIZE *Utilities.GetInstance().HEIGHT_TILE_COUNT)); sfmlForm.Controls.Add(surface); sfmlForm.ControlBox = false; sfmlForm.SizeChanged += (sender, e) => { surface.Size = sfmlForm.ClientSize; }; // Creates our SFML RenderWindow on our surface control renderWindow = new RenderWindow(surface.Handle); }