diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs index 9276ad4..05cd7a1 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs @@ -35,7 +35,9 @@ namespace HoistingCrane private MapWithSetHoistingCraneGeneric _mapHoistingCraneCollectionGeneric; + public FormMapWithSetHoistingCrane() { + InitializeComponent(); } private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e) @@ -43,6 +45,7 @@ namespace HoistingCrane AbstractMap map = null; switch (comboBoxSelectorMap.Text) { + case "Первая карта": map = new SimpleMap(); break; case "Вторая карта": @@ -86,25 +89,21 @@ namespace HoistingCrane pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); _logger.LogInformation($"Переход на карту {listBoxMaps.SelectedItem?.ToString()}"); } - /// - /// Удаление карты - /// - /// - /// - private void buttonDeleteMap_Click(object sender, EventArgs e) - { - if (listBoxMaps.SelectedIndex == -1) - { - return; - } + private void ButtonAddHoistingCrane_Click(object sender, EventArgs e) { if (_mapHoistingCraneCollectionGeneric == null) { + return; } + FormHoistingCrane form = new(); + if (form.ShowDialog() == DialogResult.OK) { + DrawingObjectHoistingCrane hoistingCrane = new(form.SelectedHoistingCrane); + if (_mapHoistingCraneCollectionGeneric + hoistingCrane == 1) { MessageBox.Show("Объект добавлен"); + pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet(); } else { @@ -112,6 +111,7 @@ namespace HoistingCrane } } } + private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(maskedTextBoxPosition.Text)) @@ -175,6 +175,7 @@ namespace HoistingCrane enums = Direction.Right; break; } + pictureBox.Image = _mapHoistingCraneCollectionGeneric.MoveObject(enums); } private void pictureBox_Click(object sender, EventArgs e) diff --git a/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs b/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs index 6704aac..5ab5352 100644 --- a/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs +++ b/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs @@ -42,7 +42,7 @@ namespace HoistingCrane Bitmap bmp = new(_pictureWidth, _pictureWidth); Graphics gr = Graphics.FromImage(bmp); DrawBackground(gr); - DrawHoistingCranes(gr); + DrawBulldozers(gr); return bmp; } @@ -107,6 +107,7 @@ namespace HoistingCrane } } + private void DrawBulldozers(Graphics gr) { int heightEl = _pictureHeight / _placeSizeHeight; int widthEl = _pictureWidth / _placeSizeWidth;