private void lbCategories_DoubleClick(object sender, EventArgs e) { object lc = ((ListBox)sender).SelectedItem; if (lc != null && lc != DBNull.Value) { FormRenameCat dlg = new FormRenameCat((ILabelCategory)lc, _layer.Symbology.Categories); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ((ILabelCategory)lc).Name = dlg.LabelCategory.Name; } } UpdateCategories(); }
/// <summary> /// Adds a new category. /// </summary> private void btnAdd_Click(object sender, EventArgs e) { //lbCategories.Items.Insert(0, _layer.Symbology.AddCategory()); //sqlExpression.AllowEmptyExpression = lbCategories.Items.Count == 1; FormRenameCat dlg = new FormRenameCat(_layer.Symbology.AddCategory(), _layer.Symbology.Categories); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { lbCategories.Items.Insert(0, dlg.LabelCategory); } else { _layer.Symbology.Categories.RemoveAt(_layer.Symbology.Categories.Count - 1); } UpdateCategories(); }