Итоговые правки.
This commit is contained in:
parent
7b57c35b71
commit
a740b44232
@ -13,7 +13,7 @@ namespace Airbus
|
||||
|
||||
public float Weight { get; private set; } //вес
|
||||
|
||||
public Color CorpusColor { get; private set; } //цвет корпуса
|
||||
public Color CorpusColor { get; set; } //цвет корпуса
|
||||
|
||||
public float Step => Speed * 100 / Weight; //шаг перемещения самолёта
|
||||
|
||||
|
@ -10,7 +10,7 @@ namespace Airbus
|
||||
internal class EntitySuperAirbus : EntityAirbus
|
||||
{
|
||||
//Дополнительный цвет
|
||||
public Color AddColor { get; private set; }
|
||||
public Color AddColor { get; set; }
|
||||
|
||||
//Признак наличия дополнительно пассажирского отсека
|
||||
public bool AddСompartment { get; private set; }
|
||||
|
1
Airbus/Airbus/FormPlaneConfig.Designer.cs
generated
1
Airbus/Airbus/FormPlaneConfig.Designer.cs
generated
@ -316,7 +316,6 @@
|
||||
this.buttonCancel.TabIndex = 4;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||
//
|
||||
// FormPlaneConfig
|
||||
//
|
||||
|
@ -30,6 +30,8 @@ namespace Airbus
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
|
||||
buttonCancel.Click += (object sender, EventArgs e) => Close();
|
||||
}
|
||||
|
||||
//отрисовка самолёт
|
||||
@ -45,10 +47,10 @@ namespace Airbus
|
||||
//добавление события
|
||||
public void AddEvent(PlaneDelegate ev)
|
||||
{
|
||||
if(EventAddPlane == null)
|
||||
if (EventAddPlane == null)
|
||||
{
|
||||
EventAddPlane = new PlaneDelegate(ev);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddPlane += ev;
|
||||
@ -82,7 +84,7 @@ namespace Airbus
|
||||
_plane = new DrawningAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_plane = new DrawningSuperAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor, labelAddColor.BackColor,
|
||||
_plane = new DrawningSuperAirbus((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, labelBaseColor.BackColor, labelAddColor.BackColor,
|
||||
checkBoxAddСompartment.Checked, checkBoxAddEngine.Checked);
|
||||
break;
|
||||
}
|
||||
@ -93,13 +95,13 @@ namespace Airbus
|
||||
//отправляем цвет с панели
|
||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Control).DoDragDrop((sender as Control).Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
(sender as Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
//проверка получаемой информации (её типа на соответсвие требуемому)
|
||||
private void LabelBaseColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
@ -112,39 +114,20 @@ namespace Airbus
|
||||
//принимаем основной цвет
|
||||
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data.GetData(DataFormats.Text).ToString())
|
||||
if (_plane != null)
|
||||
{
|
||||
case "panelRed":
|
||||
labelBaseColor.BackColor = Color.Red;
|
||||
break;
|
||||
case "panelBlack":
|
||||
labelBaseColor.BackColor = Color.Black;
|
||||
break;
|
||||
case "panelGreen":
|
||||
labelBaseColor.BackColor = Color.Green;
|
||||
break;
|
||||
case "panelYellow":
|
||||
labelBaseColor.BackColor = Color.Yellow;
|
||||
break;
|
||||
case "panelBlue":
|
||||
labelBaseColor.BackColor = Color.Blue;
|
||||
break;
|
||||
case "panelPurple":
|
||||
labelBaseColor.BackColor = Color.Purple;
|
||||
break;
|
||||
case "panelGray":
|
||||
labelBaseColor.BackColor = Color.DarkGray;
|
||||
break;
|
||||
case "panelWhite":
|
||||
labelBaseColor.BackColor = Color.White;
|
||||
break;
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
_plane.Airbus.CorpusColor = (Color)e.Data.GetData(typeof(Color));
|
||||
}
|
||||
DrawPlane();
|
||||
}
|
||||
}
|
||||
|
||||
//проверка получаемой информации (её типа на соответсвие требуемому)
|
||||
private void LabelAddColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
@ -157,48 +140,27 @@ namespace Airbus
|
||||
//принимаем дополнительный цвет
|
||||
private void labelAddColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data.GetData(DataFormats.Text).ToString())
|
||||
if (_plane != null && _plane is DrawningSuperAirbus airbus)
|
||||
{
|
||||
case "panelRed":
|
||||
labelAddColor.BackColor = Color.Red;
|
||||
break;
|
||||
case "panelBlack":
|
||||
labelAddColor.BackColor = Color.Black;
|
||||
break;
|
||||
case "panelGreen":
|
||||
labelAddColor.BackColor = Color.Green;
|
||||
break;
|
||||
case "panelYellow":
|
||||
labelAddColor.BackColor = Color.Yellow;
|
||||
break;
|
||||
case "panelBlue":
|
||||
labelAddColor.BackColor = Color.Blue;
|
||||
break;
|
||||
case "panelPurple":
|
||||
labelAddColor.BackColor = Color.Purple;
|
||||
break;
|
||||
case "panelGray":
|
||||
labelAddColor.BackColor = Color.DarkGray;
|
||||
break;
|
||||
case "panelWhite":
|
||||
labelAddColor.BackColor = Color.White;
|
||||
break;
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
if (airbus.Airbus is EntitySuperAirbus entityAirbus)
|
||||
{
|
||||
entityAirbus.AddColor = (Color)e.Data.GetData(typeof(Color));
|
||||
}
|
||||
}
|
||||
DrawPlane();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//добавление машины
|
||||
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventAddPlane?.Invoke(_plane);
|
||||
Close();
|
||||
}
|
||||
|
||||
//закрытие формы конфигурации
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user