using CarServiceBusinessLogic.BusinessLogics; using CarServiceContracts.BusinessLogicsContracts; namespace CarServiceView { public partial class FormItemTest : Form { IItemLogic _itemLogic; public FormItemTest(IItemLogic itemLogic) { _itemLogic = itemLogic; InitializeComponent(); } private void addToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(FormAddItemTest)); if (service is FormAddItemTest form) { form.ShowDialog(); LoadData(); } } private void LoadData() { var list = _itemLogic.ReadList(null); dataGridView.DataSource = list; } private void FormItemTest_Load(object sender, EventArgs e) { LoadData(); } } }