private void PhotoShowPictureBox_Click(object sender, EventArgs e) { PictureBox currentPictureBox = (PictureBox)sender; Media currentMediaToShow = MyPhotosAPI.GetMediaById((Guid)currentPictureBox.Tag); try { if (!currentMediaToShow.Deleted) { Form formToShow = new PhotoView(currentMediaToShow); formToShow.Show(); } else { DialogResult messageResult = MessageBox.Show("This " + currentMediaToShow.Type + " has been deleted recent. You want to reload media?", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (messageResult == DialogResult.Yes) { Search(); } } } catch { DialogResult messageResult = MessageBox.Show("This " + currentMediaToShow.Type + " has been moved/deleted recent from your computer. You want to delete media from database?", "Info", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (messageResult == DialogResult.Yes) { MyPhotosAPI.DeleteMediaById(currentMediaToShow.Id); Search(); } } }
private void ButtonDeleteSelected_Click(object sender, EventArgs e) { foreach (CheckBox tempCheckBox in checkedCheckBoxes) { string id = tempCheckBox.Name; MyPhotosAPI.DeleteMediaById(Guid.Parse(id)); flowLayoutPanelMyPhotos.Controls.Remove((Panel)tempCheckBox.Tag); } }