private void btnEditLupt_Click(object sender, EventArgs e) { if (SelectedLupt() == String.Empty || listViewLookupTable.SelectedItems.Count == 0) { MessageBox.Show("First select a lookup table and rule...", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } LuptEditorForm dlg = new LuptEditorForm(); dlg.ObjectClasses = this.objectClasses; dlg.Lupt = parser.LookupTables[SelectedLupt()][Convert.ToInt32(listViewLookupTable.SelectedItems[0].ImageKey)]; if (dlg.ShowDialog() == DialogResult.OK) { parser.LookupTables[SelectedLupt()][dlg.Lupt.ObjectId] = dlg.Lupt; int x = listViewLookupTable.SelectedIndices[0]; listViewLookupTable.Items[x] = new ListViewItem(dlg.Lupt.ToLuptString(), dlg.Lupt.ObjectId.ToString()); listViewLookupTable.SelectedIndices.Add(x); } listViewLookupTable.Focus(); }
private void btnNewRule_Click(object sender, EventArgs e) { if (SelectedLupt() == String.Empty) { MessageBox.Show("First select a lookup table...", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } LuptEditorForm dlg = new LuptEditorForm(); dlg.ObjectClasses = this.objectClasses; dlg.Lupt = new LookupTable(String.Empty); dlg.Lupt.Symbolization = SelectedLupt(); if (dlg.ShowDialog() == DialogResult.OK) { dlg.Lupt.ObjectId = parser.NextId; parser.NextId++; parser.LookupTables[SelectedLupt()].Add(dlg.Lupt.ObjectId, dlg.Lupt); RefillLookupTableView(); listViewLookupTable.SelectedIndices.Clear(); listViewLookupTable.SelectedIndices.Add(listViewLookupTable.Items.Count - 1); listViewLookupTable.SelectedItems[0].EnsureVisible(); listViewLookupTable.Focus(); changesSaved = false; } }
private void btnCloneRule_Click(object sender, EventArgs e) { if (SelectedLupt() == String.Empty || listViewLookupTable.SelectedItems.Count == 0) { MessageBox.Show("First select a lookup table and rule...", "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } LuptEditorForm dlg = new LuptEditorForm(); dlg.ObjectClasses = this.objectClasses; dlg.Lupt = parser.LookupTables[SelectedLupt()][Convert.ToInt32(listViewLookupTable.SelectedItems[0].ImageKey)].Clone(); if (dlg.ShowDialog() == DialogResult.OK) { dlg.Lupt.ObjectId = parser.NextId; parser.NextId++; parser.LookupTables[SelectedLupt()].Add(dlg.Lupt.ObjectId, dlg.Lupt); listViewLookupTable.Items.Add(dlg.Lupt.ToLuptString(), dlg.Lupt.ObjectId.ToString()); changesSaved = false; } listViewLookupTable.SelectedIndices.Clear(); listViewLookupTable.SelectedIndices.Add(listViewLookupTable.Items.Count - 1); //TODO - scroll listViewLookupTable.SelectedItems[0].EnsureVisible(); listViewLookupTable.Focus(); }