Eliseev E.E. LabWork05 #6
@ -103,18 +103,27 @@ namespace Airbus
|
||||
//добавление объекта
|
||||
private void ButtonAddPlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
|
||||
var formPlaneConfig = new FormPlaneConfig();
|
||||
|
||||
//TODO Call method AvvEvent from formPlaneConfig
|
||||
|
||||
formPlaneConfig.Show();
|
||||
|
||||
////////////// ЭТО
|
||||
/*if(_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Form1 form = new();
|
||||
}*/
|
||||
//////////////
|
||||
|
||||
/*Form1 form = new();
|
||||
|
||||
if(form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
DrawningObjectPlane plane = new(form.SelectedPlane);
|
||||
DrawningObjectPlane plane = new(form.SelectedPlane);*/
|
||||
|
||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + plane != -1)
|
||||
/////////////////// И ЭТО В ОТДЕЛЬНЫЙ МЕТОД
|
||||
/*if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + plane != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty].ShowSet();
|
||||
@ -122,8 +131,9 @@ namespace Airbus
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//////////////////
|
||||
//}
|
||||
}
|
||||
|
||||
//удаление объекта
|
||||
|
2
Airbus/Airbus/FormPlaneConfig.Designer.cs
generated
2
Airbus/Airbus/FormPlaneConfig.Designer.cs
generated
@ -305,6 +305,7 @@
|
||||
this.buttonAddObject.TabIndex = 3;
|
||||
this.buttonAddObject.Text = "Добавить";
|
||||
this.buttonAddObject.UseVisualStyleBackColor = true;
|
||||
this.buttonAddObject.Click += new System.EventHandler(this.ButtonAddObject_Click);
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
@ -314,6 +315,7 @@
|
||||
this.buttonCancel.TabIndex = 4;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormPlaneConfig
|
||||
//
|
||||
|
@ -15,6 +15,9 @@ namespace Airbus
|
||||
//переменная-выбранная машина
|
||||
DrawningAirbus _plane = null;
|
||||
|
||||
//событие
|
||||
private event PlaneDelegate EventAddPlane;
|
||||
|
||||
//конструктор
|
||||
public FormPlaneConfig()
|
||||
{
|
||||
@ -29,6 +32,7 @@ namespace Airbus
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
}
|
||||
|
||||
//отрисовка самолёт
|
||||
private void DrawPlane()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
@ -38,6 +42,19 @@ namespace Airbus
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
|
||||
//добавление события
|
||||
public void AddEvent(PlaneDelegate ev)
|
||||
{
|
||||
if(EventAddPlane == null)
|
||||
{
|
||||
EventAddPlane = new PlaneDelegate(ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddPlane += ev;
|
||||
}
|
||||
}
|
||||
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
@ -104,5 +121,16 @@ namespace Airbus
|
||||
//TODO Call method from object _plane is DrawningSuperAirbus and set add color
|
||||
}
|
||||
|
||||
//добавление машины
|
||||
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventAddPlane?.Invoke(_plane);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
5
Airbus/Airbus/PlaneDelegate.cs
Normal file
5
Airbus/Airbus/PlaneDelegate.cs
Normal file
@ -0,0 +1,5 @@
|
||||
namespace Airbus
|
||||
{
|
||||
//делегат для передачи объекта-самолёта
|
||||
public delegate void PlaneDelegate(DrawningAirbus plane);
|
||||
}
|
Loading…
Reference in New Issue
Block a user