AnimeDownloader.MainForm.MainForm_FormClosing C# (CSharp) Method

MainForm_FormClosing() private method

private MainForm_FormClosing ( object sender, FormClosingEventArgs e ) : void
sender object
e System.Windows.Forms.FormClosingEventArgs
return void
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (objDownloads.Objects != null)
            {
                List<DownloadItem> downs = objDownloads.Objects.Cast<DownloadItem>().ToList();
                if (downs.Any(a => a.Status == DownloadStatus.Downloading))
                {
                    DialogResult r = MessageBox.Show("Are you sure you want to quit, there is some downloads left?",
                        "Quit?",
                        MessageBoxButtons.YesNo);
                    if (r == DialogResult.No)
                    {
                        e.Cancel = true;
                        return;
                    }
                    butRemoveAll_Click(null, null);
                }
            }
            DownloadPluginHandler.Instance.Exit();
            e.Cancel = false;
        }
    }