почти работает форма
This commit is contained in:
parent
27b4633cdc
commit
366d614e4a
@ -124,10 +124,8 @@ namespace Battleship
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormBattleship form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (obj + form.SelectedShip)
|
||||
|
||||
if (obj + drawningShip)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowShips();
|
||||
@ -136,7 +134,7 @@ namespace Battleship
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click_1);
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
|
@ -21,7 +21,7 @@ namespace Battleship
|
||||
/// <summary>
|
||||
/// Событие
|
||||
/// </summary>
|
||||
private event ShipDelegate? EventAddShip;
|
||||
public event Action<DrawningShip>? EventAddShip;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
@ -56,7 +56,7 @@ namespace Battleship
|
||||
/// Добавление события
|
||||
/// </summary>
|
||||
/// <param name="ev">Привязанный метод</param>
|
||||
public void AddEvent(ShipDelegate ev)
|
||||
public void AddEvent(Action<DrawningShip> ev)
|
||||
{
|
||||
if (EventAddShip == null)
|
||||
{
|
||||
@ -119,11 +119,6 @@ namespace Battleship
|
||||
/// </summary>
|
||||
/// <param name="sender"></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)
|
||||
{
|
||||
@ -157,6 +152,12 @@ namespace Battleship
|
||||
}
|
||||
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