70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
|
using ProjectAirFighter.DrawningObjects;
|
|||
|
using ProjectAirFighter.Generics;
|
|||
|
using ProjectAirFighter.MovementStrategy;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace ProjectAirFighter
|
|||
|
{
|
|||
|
public partial class FormAirplaneCollection : Form
|
|||
|
{
|
|||
|
private readonly AirplaneslGenericCollection<DrawningAirplane, DrawningObjectAirplane> _airplanes;
|
|||
|
|
|||
|
public FormAirplaneCollection()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
_airplanes = new AirplaneslGenericCollection<DrawningAirplane,
|
|||
|
DrawningObjectAirplane>(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
|||
|
}
|
|||
|
private void deleteAirplaneButton_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (MessageBox.Show("Удалить объект?", "Удаление",
|
|||
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
int pos = Convert.ToInt32(maskedTextBox.Text);
|
|||
|
if (_airplanes - pos != null)
|
|||
|
{
|
|||
|
MessageBox.Show("Объект удален");
|
|||
|
pictureBoxCollection.Image = _airplanes.ShowAirplanes();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
MessageBox.Show("Не удалось удалить объект");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void updateCollectionButton_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
pictureBoxCollection.Image = _airplanes.ShowAirplanes();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void addAirplaneButton_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
FormAirFighter form = new();
|
|||
|
if (form.ShowDialog() == DialogResult.OK)
|
|||
|
{
|
|||
|
if (_airplanes + form.SelectedAirplane != null)
|
|||
|
{
|
|||
|
MessageBox.Show("Объект добавлен");
|
|||
|
pictureBoxCollection.Image = _airplanes.ShowAirplanes();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
MessageBox.Show("Не удалось добавить объект");
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|