Delete functionality added

sort-delete
Aaron 3 years ago
parent 802d2ea2e3
commit ba8d8f0cd0

@ -458,11 +458,19 @@ namespace photo_sorter
{ {
if (MessageBox.Show("Are you sure you want to delete this photo?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) if (MessageBox.Show("Are you sure you want to delete this photo?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{ {
MessageBox.Show("Poof! The photo would normally get deleted here if this function's code were completed, but alas, it is not, so this photo you have deemed to be subpar is still existing."); string src_fname = global.filenames[global.position];
} try
else {
{ File.Delete(src_fname);
MessageBox.Show("Forsooth! This photo is a keeper after all and would not have been deleted!"); status_msg("Deleted file: " + src_fname, 2);
remove_index(global.position);
update_image();
}
catch (IOException ex)
{
status_msg("Unable to delete " + src_fname + "!", 4);
MessageBox.Show(ex.ToString(), "Critical: IO Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} }
} }
public void prerender_init() public void prerender_init()

Loading…
Cancel
Save