Изменил(а) на 'HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs'

Signed-off-by: RomanovEgor <romanov17903@gmail.com>
This commit is contained in:
RomanovEgor 2022-12-25 10:42:46 +04:00 committed by 10Г Егор Романов
parent b673e852b5
commit 1a47187541

View File

@ -30,7 +30,10 @@ namespace HoistingCrane
break; break;
case "Вторая карта": case "Вторая карта":
map = new SecondMap(); map = new SecondMap();
break; break;
} }
if (map != null) if (map != null)
{ {
@ -47,24 +50,26 @@ namespace HoistingCrane
{ {
if (_mapHoistingCraneCollectionGeneric == null) if (_mapHoistingCraneCollectionGeneric == null)
{ {
return; var formHoistingCraneConfig = new FormHoistingCraneConfig();
} formHoistingCraneConfig.AddEvent(AddHoistingCrane);
FormHoistingCrane form = new(); formHoistingCraneConfig.Show();
if (form.ShowDialog() == DialogResult.OK) }
private void AddHoistingCrane(DrawingHoistingCrane drawingHoistingCrane)
{
DrawingObjectHoistingCrane hoistingCrane = new DrawingObjectHoistingCrane(drawingHoistingCrane);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + hoistingCrane != -1)
{ {
DrawingObjectHoistingCrane hoistingCrane = new(form.SelectedHoistingCrane); MessageBox.Show("Объект добавлен");
if (_mapHoistingCraneCollectionGeneric + hoistingCrane == 1) pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
{ }
MessageBox.Show("Объект добавлен"); else
pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet(); {
} MessageBox.Show("Не удалось добавить объект");
else
{
MessageBox.Show("Не удалось добавить объект");
}
} }
} }
}
}
}
private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e) private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text)) if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))