/// <summary> /// Добавит команду на БО /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void insert_Click(object sender, EventArgs e) { InsertBOForm frm = new InsertBOForm(app); if (frm.ShowDialog(this) == DialogResult.OK) { DisplayPacket packet = frm.DisplayPacket; if (packet != null) { app.Display.Insert(packet); InsertToList(packet); } } }
/// <summary> /// Редактировать пакет для БО /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void edit_Click(object sender, EventArgs e) { if (listViewBos.SelectedItems != null) { if (listViewBos.SelectedItems.Count > 0) { if (listViewBos.SelectedItems[0].Tag != null) { if (listViewBos.SelectedItems[0].Tag is DisplayPacket) { DisplayPacket pack = listViewBos.SelectedItems[0].Tag as DisplayPacket; if (pack != null) { InsertBOForm frm = new InsertBOForm(app); frm.DisplayPacket = pack; if (frm.ShowDialog(this) == DialogResult.OK) { DisplayPacket packet = frm.DisplayPacket; if (packet != null) { //app.Display.Insert(packet); //InsertToList(packet); listViewBos.SelectedItems[0].SubItems[1].Text = packet.Device.ToString(); listViewBos.SelectedItems[0].SubItems[2].Text = packet.Description; if (packet.TypePort == TypePort.Primary) { listViewBos.SelectedItems[0].SubItems[3].Text = "Основной"; } else if (packet.TypePort == TypePort.Secondary) { listViewBos.SelectedItems[0].SubItems[3].Text = "Вспомогательный"; } else { listViewBos.SelectedItems[0].SubItems[3].Text = "Не определен"; } } } } } } } } }