BF2Statistics.SnapshotViewForm.DeleteBtn_Click C# (CSharp) Method

DeleteBtn_Click() private method

Event fired when the Delete button is clicked
private DeleteBtn_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            // List of files to process
            List<SnapshotFile> Files = new List<SnapshotFile>();
            foreach (ListViewItem I in SnapshotView.Items)
            {
                if (I.Checked)
                    Files.Add(I.Tag as SnapshotFile);
            }

            // Make sure we have a snapshot selected
            if (Files.Count == 0)
            {
                MessageBox.Show("You must select at least 1 snapshot to process.", "Error");
                return;
            }
            else
            {
                // Comfirm
                DialogResult Res = MessageBox.Show("Are you sure you want to delete these snapshots? This process cannot be reversed!", 
                    "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question
                );

                if (Res == DialogResult.No)
                    return;

                // Delete each snapshot file
                foreach (SnapshotFile sFile in Files)
                    File.Delete(sFile.FilePath);

                // Rebuild the list
                BuildList();
            }
        }