Example #1
0
        private void btnRenameCat_Click(object sender, EventArgs e)
        {
            if (ixItemSelected < 1)
            {
                return;
            }
            string catname = _categories.Items[ixItemSelected].ToString();
            Prompt p       = new Prompt();

            p.Text           = Loc.Get("Rename category");
            p.lblPrompt.Text = Loc.Get("Please enter a new name for the category:");
            if (p.ShowDialog() == DialogResult.OK)
            {
                string newname = p._input.Text;
                if (newname != "")
                {
                    if (_categories.Items.Contains(newname))
                    {
                        MessageBox.Show(Loc.Get("Name is already in use"), Loc.Get("Error"));
                        return;
                    }

                    PhotoInfo.RenameCategory(catname, newname);
                    LoadCategories(); // refresh the list

                    // update the current category for the photo prevew container
                    photoPreviewContainer1.CurrentCategory = newname;
                }
            }
        }