Переписан метод добавления объекта
This commit is contained in:
parent
df129f6eab
commit
4b35bb8677
@ -108,25 +108,30 @@ namespace ArmoredCar
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddarmoredCar_Click(object sender, EventArgs e)
|
||||
{
|
||||
var form = new FormArmoredCarConfig();
|
||||
form.AddEvent(AddArmoredCar);
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void AddArmoredCar(DrawningArmoredCar drawningArmoredCar)
|
||||
{
|
||||
if (listBoxMaps.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormCar form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
|
||||
DrawningObjectArmCar armoredCar = new(drawningArmoredCar);
|
||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + armoredCar > -1)
|
||||
{
|
||||
DrawningObjectArmCar armoredCar = new(form.SelectedCar);
|
||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + armoredCar > -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление объекта
|
||||
|
Loading…
Reference in New Issue
Block a user