ISEbd-22_Rozhkov.I.E._Simple/GasStation/FormGasstation.cs
2024-11-15 18:27:06 +04:00

78 lines
2.3 KiB
C#

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<FormGasmen>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SupplierToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSuppliers>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ProductToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormProducts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SupplyToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSupplies>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SellingToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSellings>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà ïðè äîáàâëåíèè", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}