почтии
This commit is contained in:
parent
d1ad010777
commit
ea6a49ba00
@ -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);
|
||||
|
@ -60,5 +60,4 @@ namespace HoistingCrane.CollectionGenericObjects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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>
|
||||
/// Передача основного цвета
|
||||
|
Loading…
Reference in New Issue
Block a user