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().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void PassangersToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void TicketsToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void PlanesToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void PreparatoryWorksToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }