private void toolRenameSchema_Click(object sender, EventArgs e) { if (_module == null || _module.MapDocument == null || _module[_module.MapDocument.FocusMap] == null) { return; } if (cmbSchemas.SelectedItem is SnapSchemaItem) { SnapSchemaItem item = (SnapSchemaItem)cmbSchemas.SelectedItem; if (!(item.SnapSchema is SnapSchema)) { return; } FormNewSchema dlg = new FormNewSchema(item.SnapSchema.Name); if (dlg.ShowDialog() == DialogResult.OK) { ((SnapSchema)item.SnapSchema).Name = dlg.SnapSchemaName; int index = cmbSchemas.Items.IndexOf(item); if (index < 0) { return; } // Refresh List cmbSchemas.Items.Remove(item); cmbSchemas.Items.Insert(index, item); cmbSchemas.SelectedIndex = index; } } }
private void toolMoveDown_Click(object sender, EventArgs e) { if (cmbSchemas.SelectedItem is SnapSchemaItem) { SnapSchemaItem item = (SnapSchemaItem)cmbSchemas.SelectedItem; int index = cmbSchemas.Items.IndexOf(item); if (index < 0 || index >= cmbSchemas.Items.Count - 1) { return; } cmbSchemas.Items.Remove(item); cmbSchemas.Items.Insert(index + 1, item); cmbSchemas.SelectedIndex = index + 1; } }
private void toolMoveUp_Click(object sender, EventArgs e) { if (cmbSchemas.SelectedItem is SnapSchemaItem) { SnapSchemaItem item = (SnapSchemaItem)cmbSchemas.SelectedItem; int index = cmbSchemas.Items.IndexOf(item); if (index <= 0) { return; } cmbSchemas.Items.Remove(item); cmbSchemas.Items.Insert(index - 1, item); cmbSchemas.SelectedIndex = index - 1; } }