PIbd-22_Shabunov_O.A._AirBo.../AirBomber/FormEntityCollection.cs
2023-11-19 17:11:10 +04:00

62 lines
2.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using AirBomber.Generics;
using AirBomber.MovementStrategy;
using AirBomber.Rendering;
namespace AirBomber
{
public partial class FormEntityCollection : Form
{
private readonly EntitiesGenericCollection<BomberRendererBase, ObjectEntityRenderer> _entities;
public FormEntityCollection()
{
InitializeComponent();
_entities = new EntitiesGenericCollection<BomberRendererBase, ObjectEntityRenderer>(
CollectionPictureBox.Width, CollectionPictureBox.Height
);
}
public void ButtonAddEntity_Click(object sender, EventArgs e)
{
BomberForm Form = new BomberForm();
if (Form.ShowDialog() == DialogResult.OK)
{
if (_entities + Form.SelectedRenderer != -1)
{
MessageBox.Show("Объект добавлен");
CollectionPictureBox.Image = _entities.ShowEntities();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
}
public void ButtonRemoveEntity_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return;
int Pos = Convert.ToInt32(NumberMaskedTextBox.Text);
if (_entities - Pos == true)
{
MessageBox.Show("Объект удален");
CollectionPictureBox.Image = _entities.ShowEntities();
}
else
{
MessageBox.Show("Не удалось удалить объект");
}
}
public void ButtonRefreshCollection_Click(object sender, EventArgs e)
{
CollectionPictureBox.Image = _entities.ShowEntities();
}
}
}