почти работает форма
This commit is contained in:
parent
27b4633cdc
commit
366d614e4a
@ -124,10 +124,8 @@ namespace Battleship
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormBattleship form = new();
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (obj + drawningShip)
|
||||||
{
|
|
||||||
if (obj + form.SelectedShip)
|
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxCollection.Image = obj.ShowShips();
|
pictureBoxCollection.Image = obj.ShowShips();
|
||||||
@ -136,7 +134,7 @@ namespace Battleship
|
|||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonRemoveShip_Click(object sender, EventArgs e)
|
private void buttonRemoveShip_Click(object sender, EventArgs e)
|
||||||
|
1
Battleship/Battleship/FormShipConfig.Designer.cs
generated
1
Battleship/Battleship/FormShipConfig.Designer.cs
generated
@ -326,6 +326,7 @@
|
|||||||
this.buttonAdd.TabIndex = 13;
|
this.buttonAdd.TabIndex = 13;
|
||||||
this.buttonAdd.Text = "Добавить";
|
this.buttonAdd.Text = "Добавить";
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click_1);
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
|
@ -21,7 +21,7 @@ namespace Battleship
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Событие
|
/// Событие
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private event ShipDelegate? EventAddShip;
|
public event Action<DrawningShip>? EventAddShip;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -56,7 +56,7 @@ namespace Battleship
|
|||||||
/// Добавление события
|
/// Добавление события
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ev">Привязанный метод</param>
|
/// <param name="ev">Привязанный метод</param>
|
||||||
public void AddEvent(ShipDelegate ev)
|
public void AddEvent(Action<DrawningShip> ev)
|
||||||
{
|
{
|
||||||
if (EventAddShip == null)
|
if (EventAddShip == null)
|
||||||
{
|
{
|
||||||
@ -119,11 +119,6 @@ namespace Battleship
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
EventAddShip?.Invoke(_ship);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
@ -157,6 +152,12 @@ namespace Battleship
|
|||||||
}
|
}
|
||||||
DrawShip();
|
DrawShip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click_1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddShip?.Invoke(_ship);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
using Battleship.DrawningObjects;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Battleship
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Делегат для передачи объекта-автомобиля
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="car"></param>
|
|
||||||
public delegate void ShipDelegate(DrawningShip car);
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user