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(); }
private void btnUnlink_Click(object sender, EventArgs e) { if (ppiCurrent == null) { return; } string txt = Loc.Get("Are you sure you want to remove the image from the current category") + "?"; if (MessageBox.Show(this, txt, Loc.Get("Warning"), MessageBoxButtons.YesNo) == DialogResult.Yes) { PhotoInfo.RemoveImageFromCat(ppiCurrent.PhotoInfo.ImageId, photoPreviewContainer1.CurrentCategory); photoPreviewContainer1.Controls.Remove(ppiCurrent); } }