почтии

This commit is contained in:
Vladislav_396ntk 2024-04-15 11:28:15 +04:00
parent d1ad010777
commit ea6a49ba00
4 changed files with 36 additions and 24 deletions

View File

@ -29,7 +29,7 @@ namespace HoistingCrane.CollectionGenericObjects
{
set
{
if(value > 0)
if (value > 0)
{
_maxCount = value;
}
@ -39,11 +39,8 @@ namespace HoistingCrane.CollectionGenericObjects
public T? Get(int position)
{
// TODO проверка позиции
if(position >= 0 && position < _maxCount)
{
return list[position];
}
return null;
if (position >= Count || position < 0) return null;
return list[position];
}
@ -70,15 +67,12 @@ namespace HoistingCrane.CollectionGenericObjects
}
list.Insert(position, obj);
return position;
}
public T? Remove(int position)
{
// TODO проверка позиции
// TODO удаление объекта из списка
if(position >= 0 && position < list.Count)
if (position >= 0 && position < list.Count)
{
T? temp = list[position];
list.RemoveAt(position);

View File

@ -60,5 +60,4 @@ namespace HoistingCrane.CollectionGenericObjects
}
}
}
}

View File

@ -64,9 +64,29 @@ namespace HoistingCrane
}
return color;
}
private void buttonCreateHoistingCrane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningHoistingCrane));
private void buttonCreateHoistingCrane_Click(object sender, EventArgs e)
{
FormCarConfig form = new();
form.Show();
form.AddEvent(SetCar);
}
private void SetCar(DrawningTrackedVehicle drawningTrackedVehicle)
{
if (_company == null || drawningTrackedVehicle == null)
{
return;
}
private void buttonCreateTrackedVehicle_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTrackedVehicle));
if (_company + drawningTrackedVehicle != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
private void buttonDeleteCar_Click(object sender, EventArgs e)
{

View File

@ -117,11 +117,10 @@ namespace HoistingCrane
/// <param name="e"></param>
private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
{
if (car != null)
{
car.EntityTrackedVehicle?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
DrawObject();
}
if (car == null)
return;
car.EntityTrackedVehicle?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
DrawObject();
}
/// <summary>
/// Передача основного цвета