private void Form1_Shown(object sender, EventArgs e) { enterprise = new Enterprise(); controller = new FormPBXController(this, enterprise); var Agents = enterprise.GetAgents(); foreach (var a in Agents) { var item = lvAgents.Items.Add(a); item.Name = a; item.SubItems.Add(enterprise.GetAgentStateName(a)); item.SubItems.Add("-"); } enterprise.AgentStateChanged += Enterprise_AgentStateChanged; enterprise.NewTask += Enterprise_NewTask; enterprise.TaskGone += Enterprise_TaskGone; enterprise.TaskChanged += Enterprise_TaskChanged; }