This commit is contained in:
ValAnn 2023-11-17 17:08:35 +04:00
parent d8c9a506d7
commit dad5aefdd0
2 changed files with 9 additions and 14 deletions

View File

@ -19,7 +19,7 @@ namespace DumpTruck
{ {
public partial class FormCarCollection : Form public partial class FormCarCollection : Form
{ {
//private readonly CarsGenericCollection<DrawningCar, DrawningObjectCar> _cars;
private readonly CarsGenericStorage _storage; private readonly CarsGenericStorage _storage;
public FormCarCollection() public FormCarCollection()
{ {
@ -28,16 +28,6 @@ namespace DumpTruck
pictureBoxCollection.Height); pictureBoxCollection.Height);
} }
private void Form2_Load(object sender, EventArgs e)
{
}
private void pictureBoxCollection_Click(object sender, EventArgs e)
{
}
private void ReloadObjects() private void ReloadObjects()
{ {
int index = listBoxStorages.SelectedIndex; int index = listBoxStorages.SelectedIndex;
@ -78,7 +68,7 @@ pictureBoxCollection.Height);
FormCarConfig form = new FormCarConfig(); FormCarConfig form = new FormCarConfig();
form.Show(); form.Show();
CarDelegate? carDelegate = new((m) => Action<DrawningCar>? carDelegate = new((m) =>
{ {
int q = obj + m; int q = obj + m;
@ -92,6 +82,11 @@ pictureBoxCollection.Height);
MessageBox.Show("Не удалось добавить объект"); MessageBox.Show("Не удалось добавить объект");
} }
}); });
Action<Color>? ColorDelegate = new((m) =>
{
MessageBox.Show(m.ToString());
});
form.AddEvent(carDelegate); form.AddEvent(carDelegate);
} }

View File

@ -15,7 +15,7 @@ namespace DumpTruck
{ {
DrawningCar? _car = null; DrawningCar? _car = null;
private event CarDelegate? EventAddCar; public event Action<DrawningCar>? EventAddCar;
public FormCarConfig() public FormCarConfig()
{ {
@ -123,7 +123,7 @@ DragDropEffects.Move | DragDropEffects.Copy);
DrawCar(); DrawCar();
} }
public void AddEvent(CarDelegate ev) public void AddEvent(Action<DrawningCar> ev)
{ {
if (EventAddCar == null) if (EventAddCar == null)
{ {