diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs index 73f94b7..78ff45b 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.Designer.cs @@ -121,7 +121,6 @@ this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; this.comboBoxSelectorMap.Size = new System.Drawing.Size(200, 28); this.comboBoxSelectorMap.TabIndex = 0; - this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged); // // textBoxNewMapName // diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs index 1485f78..4580210 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs @@ -29,7 +29,6 @@ namespace HoistingCrane /// private readonly MapsCollection _mapsCollection; /// - private MapWithSetHoistingCraneGeneric _mapHoistingCraneCollectionGeneric; public FormMapWithSetHoistingCrane(ILogger logger) { InitializeComponent(); @@ -63,29 +62,6 @@ namespace HoistingCrane listBoxMaps.SelectedIndex = index; } } - private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e) - { - AbstractMap map = null; - switch (comboBoxSelectorMap.Text) - { - case "Простая карта": - map = new SimpleMap(); - break; - case "Вторая карта": - map = new SecondMap(); - break; - - } - if (map != null) - { - _mapHoistingCraneCollectionGeneric = new MapWithSetHoistingCraneGeneric( - pictureBox.Width, pictureBox.Height, map); - } - else - { - _mapHoistingCraneCollectionGeneric = null; - } - } /// /// Добавление карты /// @@ -245,7 +221,7 @@ namespace HoistingCrane enums = Direction.Right; break; } - pictureBox.Image = _mapHoistingCraneCollectionGeneric.MoveObject(enums); + pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(enums); } private void saveToolStripMenuItem_Click(object sender, EventArgs e) {