LabWork03
This commit is contained in:
parent
b78ad0fb51
commit
87a93c30f8
@ -92,7 +92,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
|
|
||||||
public T? Remove(int position)
|
public T? Remove(int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= _collection.Length || _collection[position] == null) // проверка позиции и наличия объекта
|
if (position < 0 || position >= _collection.Length || _collection[position] == null)
|
||||||
return null;
|
return null;
|
||||||
T? temp = _collection[position];
|
T? temp = _collection[position];
|
||||||
_collection[position] = null;
|
_collection[position] = null;
|
||||||
|
@ -36,25 +36,25 @@ public class TankSharingService : AbstractCompany
|
|||||||
int width = _pictureWidth / _placeSizeWidth;
|
int width = _pictureWidth / _placeSizeWidth;
|
||||||
int height = _pictureHeight / _placeSizeHeight;
|
int height = _pictureHeight / _placeSizeHeight;
|
||||||
|
|
||||||
int locomotiveWidth = 0;
|
int tankWidth = 0;
|
||||||
int locomotiveHeight = height - 1;
|
int tankHeight = height - 1;
|
||||||
|
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||||
{
|
{
|
||||||
if (_collection.Get(i) != null)
|
if (_collection.Get(i) != null)
|
||||||
{
|
{
|
||||||
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
_collection.Get(i).SetPosition(_placeSizeWidth * locomotiveWidth + 20, locomotiveHeight * _placeSizeHeight + 20);
|
_collection.Get(i).SetPosition(_placeSizeWidth * tankWidth + 20, tankHeight * _placeSizeHeight + 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locomotiveWidth < width - 1)
|
if (tankWidth < width - 1)
|
||||||
locomotiveWidth++;
|
tankWidth++;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
locomotiveWidth = 0;
|
tankWidth = 0;
|
||||||
locomotiveHeight--;
|
tankHeight--;
|
||||||
}
|
}
|
||||||
if (locomotiveHeight < 0)
|
if (tankHeight < 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -107,10 +107,12 @@ public partial class FormTankCollection : Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
|
|
||||||
if (_company - pos != null)
|
if (_company - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBox.Image = _company.Show();
|
pictureBox.Image = _company.Show();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user