using ClientsContracts.BusinessLogicContracts; using Unity; namespace WinForms { public partial class FormMain : Form { private readonly IClientLogic _clientLogic; private readonly IStatusLogic _statusLogic; public FormMain(IClientLogic clientLogic, IStatusLogic statusLogic) { _clientLogic = clientLogic; _statusLogic = statusLogic; InitializeComponent(); List stringToHierachy = new List() { "Status", "Amount", "Id", "Name" }; myTreeView1.addToHierarchy(stringToHierachy); } private void FormMain_Load(object sender, EventArgs e) { LoadData(); } private void LoadData() { try { var list = _clientLogic.Read(null); myTreeView1.LoadTree(list); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void AddNewElement() { var form = Program.Container.Resolve(); if (form.ShowDialog() == DialogResult.OK) { LoadData(); } } } }