using GasStation.Forms; using Unity; namespace GasStation { public partial class FormGasStation : System.Windows.Forms.Form { private readonly IUnityContainer _container; public FormGasStation(IUnityContainer container) { InitializeComponent(); _container = container ?? throw new ArgumentNullException(nameof(container)); } private void GasmanToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void SupplierToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void ProductToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void SupplyToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void SellingToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }