ISEbd-21_Sharonov_I_A_Proje.../ProjectAirline/FormAirline.cs

76 lines
2.0 KiB
C#

using ProjectAirline.Forms;
using Unity;
namespace ProjectAirline;
public partial class FormAirline : Form
{
private readonly IUnityContainer _container;
public FormAirline(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void FlightsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormFlights>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void PassangersToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPassangers>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void TicketsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormTickets>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void PlanesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPlanes>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void PreparatoryWorksToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormPreparatoryWorks>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}