using Unity; namespace ProjectLibrary { public partial class FormLibrary : Form { private readonly IUnityContainer _container; public FormLibrary(IUnityContainer container) { InitializeComponent(); _container = container ?? throw new ArgumentNullException(nameof(container)); } private void ÷èòàòåëèToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void çàêàçàòüÊíèãèToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void êíèãàToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void áèáëèîòåêèToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void îáíîâëåíèåÁèëåòàToolStripMenuItem_Click(object sender, EventArgs e) { try { _container.Resolve().ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }