public void InitIndicators(int i, AlgorithmForm algorithmForm) { algorithmForm.lblCapacity.Text = worldController.world.tanks[i].turret.waterCapacity.ToString(); algorithmForm.lblPressure.Text = worldController.world.tanks[i].turret.waterPressure.ToString(); algorithmForm.pbReady.Visible = worldController.world.tanks[i].turret.weaponReady; algorithmForm.pbUnready.Visible = !worldController.world.tanks[i].turret.weaponReady; algorithmForm.pbUp.Visible = worldController.world.tanks[i].turret.up; algorithmForm.pbDown.Visible = !worldController.world.tanks[i].turret.up; algorithmForm.lblMaxCapacity.Text = worldController.world.tanks[i].turret.maxWaterCapacity.ToString(); algorithmForm.lblMaxPressure.Text = worldController.world.tanks[i].turret.maxWaterPressure.ToString(); }
private void OpenAlgorithmForm(AlgorithmForm algorithmForm) { algorithmForm.Visible = true; algorithmForm.Select(); }
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); }