Example #1
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            // Add to the main category "All"
            PhotoInfo.AddImage2Cat(imageId, "All");

            // Add to all other categories
            for (int i = 0; i < _categories.Items.Count; i++)
            {
                string cat       = _categories.Items[i].ToString();
                bool   isChecked = _categories.GetItemChecked(i);
                bool   isAdded   = (bool)categories[cat];
                if (isAdded != isChecked)
                {
                    if (isAdded)
                    {
                        PhotoInfo.RemoveImageFromCat(imageId, cat);
                    }
                    else
                    {
                        PhotoInfo.AddImage2Cat(imageId, cat);
                    }
                }
            }
            DialogResult = DialogResult.OK;
            this.Close();
        }