private void AddMatrixPort(lists.ATMLListControl listView) { MatrixPortForm form = new MatrixPortForm(); form.MatrixPort = new MatrixPort(); if (DialogResult.OK == form.ShowDialog()) { MatrixPort port = form.MatrixPort; ListViewItem lvi = new ListViewItem(port.name); lvi.SubItems.Add(port.Description); lvi.SubItems.Add(port.baseIndexSpecified ? "" + port.baseIndex : ""); lvi.SubItems.Add(port.countSpecified ? "" + port.count : ""); lvi.SubItems.Add(port.incrementBySpecified ? "" + port.incrementBy : ""); lvi.SubItems.Add(port.replacementCharacter); lvi.Tag = port; listView.Items.Add(lvi); } }
private void EditMatrixPort(lists.ATMLListControl listView) { if (lvColumns.SelectedItems.Count > 0) { ListViewItem lvi = listView.SelectedItems[0]; MatrixPortForm form = new MatrixPortForm(); form.MatrixPort = (MatrixPort)lvi.Tag; if (DialogResult.OK == form.ShowDialog()) { MatrixPort port = form.MatrixPort; lvi.SubItems[0].Text = port.name; lvi.SubItems[1].Text = port.Description; lvi.SubItems[2].Text = port.baseIndexSpecified ? "" + port.baseIndex : ""; lvi.SubItems[3].Text = port.countSpecified ? "" + port.count : ""; lvi.SubItems[4].Text = port.incrementBySpecified ? "" + port.incrementBy : ""; lvi.SubItems[5].Text = port.replacementCharacter; lvi.Tag = port; } } }