/// <summary>
        /// Shut down the build process thread and clean up on exit
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void NamespacesDlg_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (cancellationTokenSource != null && this.DialogResult != DialogResult.Cancel)
            {
                if (MessageBox.Show("A build is currently taking place to obtain namespace information.  Do " +
                                    "you want to abort it and close this form?", Constants.AppName, MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.No)
                {
                    e.Cancel = true;
                    return;
                }

                if (cancellationTokenSource != null)
                {
                    cancellationTokenSource.Cancel();
                    e.Cancel = true;
                }

                return;
            }

            // Add new items that were modified
            foreach (var item in lbNamespaces.Items.OfType <NamespaceSummaryItem>().Where(ns => ns.IsDirty))
            {
                if (nsColl[item.Name] == null)
                {
                    nsColl.Add(item);
                }
            }

            this.DialogResult = nsColl.Any(ns => ns.IsDirty) ? DialogResult.OK : DialogResult.Cancel;

            if (tempProject != null)
            {
                try
                {
                    // Delete the temporary project's working files
                    if (!String.IsNullOrEmpty(tempProject.OutputPath) && Directory.Exists(tempProject.OutputPath))
                    {
                        Directory.Delete(tempProject.OutputPath, true);
                    }
                }
                catch
                {
                    // Eat the exception.  We'll ignore it if the temporary files cannot be deleted.
                }

                tempProject.Dispose();
                tempProject = null;
            }
        }