устранение замечаний преподавателя
This commit is contained in:
parent
6f8d738bf3
commit
a8c4a84c2c
@ -152,11 +152,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
DrawningObjectLocomotive removableObject = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos;
|
var removableObject = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty, pos];
|
||||||
if (removableObject != null)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
_mapsCollection.RemovedObject = removableObject;
|
_mapsCollection.RemovedObject = (DrawningObjectLocomotive)removableObject;
|
||||||
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -230,11 +230,13 @@
|
|||||||
{
|
{
|
||||||
if (_mapsCollection.RemovedObject == null)
|
if (_mapsCollection.RemovedObject == null)
|
||||||
{
|
{
|
||||||
|
MessageBox.Show("Коллекция удалённых элементов пуста");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormLocomotive formWithLastRemovedObject = new(_mapsCollection.RemovedObject._locomotive);
|
FormLocomotive formWithLastRemovedObject = new(_mapsCollection.RemovedObject._locomotive);
|
||||||
formWithLastRemovedObject.Show();
|
formWithLastRemovedObject.Show();
|
||||||
formWithLastRemovedObject.Draw();
|
formWithLastRemovedObject.Draw();
|
||||||
|
_mapsCollection.RemoveLastObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,14 @@
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return _removedObjects.Last.Value;
|
var removedObject = _removedObjects.Last();
|
||||||
|
return removedObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void RemoveLastObject()
|
||||||
|
{
|
||||||
|
_removedObjects.RemoveLast();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user