private void RenamePalette_BTN(object sender, EventArgs e) { int selectedIndex = PaletteSelector.SelectedIndex; if (selectedIndex > -1) { DialogResult dialog = new RenamePalette().ShowDialog(this); if (dialog == DialogResult.OK) { if (RenamePalette.ResultText.Length > 0) { DatabaseManager.RenamePalette(selectedIndex, RenamePalette.ResultText); PaletteSelector.Items.Clear(); var d = DatabaseManager.GetPalets(); foreach (PaletteCategory ddd in d) { PaletteSelector.Items.Add(ddd.DbName); } PaletteSelector.Text = RenamePalette.ResultText; PaletteSelector.SelectedIndex = selectedIndex; } } } }
private void JColorPalete1_OnColorAction(object sender, ColorEvent e) { if (jColorPalette1.Selected != null) { int selectedIndex = PaletteSelector.SelectedIndex; if (selectedIndex > -1) { DialogResult dialog = new RenamePalette(e.Item.ColorName).ShowDialog(this); if (dialog == DialogResult.OK) { if (RenamePalette.ResultText.Length > 0) { jColorPalette1.Selected.ColorName = RenamePalette.ResultText; DatabaseManager.SetPaletteItems(selectedIndex, jColorPalette1.PaletteData); jColorPalette1.PaletteData = DatabaseManager.GetPalette(selectedIndex); } } } } else { JMessageBox.Show(this, "Please select the Palete first."); } }