/// <summary> /// Adds a dialect formulation to the list /// </summary> private void btnAdd_Click(object sender, EventArgs e) { IEnumerable <string> list = ((IEnumerable)listView1.Items).Cast <ListViewItem>().Select(item => item.SubItems[2].Text); frmEnterProjection form = new frmEnterProjection(m_coordinateSystem, list, m_database); if (form.ShowDialog() == DialogResult.OK) { ListViewItem item = this.listView1.Items.Add((m_index++).ToString()); this.UpdateDialectString(item, form.textBox1.Text); item.Selected = true; m_dialectsChanged = true; } }
/// <summary> /// Edits projection string. Returns true if editing took place /// </summary> private void EditProjection() { if (listView1.SelectedItems.Count > 0) { string text = listView1.SelectedItems[0].SubItems[2].Text; // building the list of available dialects List <string> list = new List <string>(); foreach (ListViewItem item in listView1.Items) { if (!item.Selected) { list.Add(item.SubItems[2].Text); } } frmEnterProjection form = new frmEnterProjection(m_coordinateSystem, list, m_database); form.textBox1.Text = text; if (form.ShowDialog() == DialogResult.OK) { listView1.SelectedItems[0].SubItems[2].Text = form.textBox1.Text; } } }