RadioDld.Main.ButtonDelete_Click C# (CSharp) Method

ButtonDelete_Click() private method

private ButtonDelete_Click ( ) : void
return void
        private void ButtonDelete_Click()
        {
            int epid = Convert.ToInt32(this.ListDownloads.SelectedItems[0].Name, CultureInfo.InvariantCulture);
            Model.Download info = new Model.Download(epid);

            bool fileExists = File.Exists(info.DownloadPath);
            string delQuestion = "Are you sure that you would like to delete this episode";

            if (fileExists)
            {
                delQuestion += " and the associated audio file";
            }

            if (Interaction.MsgBox(delQuestion + "?", MsgBoxStyle.Question | MsgBoxStyle.YesNo) == MsgBoxResult.Yes)
            {
                if (fileExists)
                {
                    try
                    {
                        File.Delete(info.DownloadPath);
                    }
                    catch (IOException)
                    {
                        if (Interaction.MsgBox("There was a problem deleting the audio file for this episode, as the file is in use by another application." + Environment.NewLine + Environment.NewLine + "Would you like to delete the episode from the list anyway?", MsgBoxStyle.Exclamation | MsgBoxStyle.YesNo) == MsgBoxResult.No)
                        {
                            return;
                        }
                    }
                    catch (UnauthorizedAccessException)
                    {
                        if (Interaction.MsgBox("There was a problem deleting the audio file for this episode, as the file is either read-only or you do not have the permissions required." + Environment.NewLine + Environment.NewLine + "Would you like to delete the episode from the list anyway?", MsgBoxStyle.Exclamation | MsgBoxStyle.YesNo) == MsgBoxResult.No)
                        {
                            return;
                        }
                    }
                }

                Model.Download.Remove(epid);
            }
        }
Main