почтии

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

@ -39,12 +39,9 @@ namespace HoistingCrane.CollectionGenericObjects
public T? Get(int position) public T? Get(int position)
{ {
// TODO проверка позиции // TODO проверка позиции
if(position >= 0 && position < _maxCount) if (position >= Count || position < 0) return null;
{
return list[position]; return list[position];
} }
return null;
}
public int Insert(T obj) public int Insert(T obj)
@ -70,10 +67,7 @@ namespace HoistingCrane.CollectionGenericObjects
} }
list.Insert(position, obj); list.Insert(position, obj);
return position; return position;
} }
public T? Remove(int position) public T? Remove(int position)
{ {
// TODO проверка позиции // TODO проверка позиции

View File

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

View File

@ -64,9 +64,29 @@ namespace HoistingCrane
} }
return color; 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) private void buttonDeleteCar_Click(object sender, EventArgs e)
{ {

View File

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