/// <summary>
        /// Handle the Click event on the "Decompile" button.
        /// </summary>
        /// <param name="sender">Object sending this event.</param>
        /// <param name="e">Parameter associated with this event.</param>
        private void decompileButton_Click(object sender, EventArgs e)
        {
            // Get the path where we should export all files
            string basePath = pathTextBox.Text.Trim();

            basePath = Path.GetFullPath(basePath);

            // Use the thread pool to run the export
            WaitCallback   exporterCallback = new WaitCallback(WorkerThreadStart);
            ExportWorkItem workItem         = new ExportWorkItem(this, basePath, ArtifactsToExport);

            ThreadPool.QueueUserWorkItem(exporterCallback, workItem);
        }
        /// <summary>
        /// Export worker thread main entry point.
        /// </summary>
        /// <param name="parameters">Parameters passed to the worker thread (as an ExportWorkItem).</param>
        private static void WorkerThreadStart(object parameters)
        {
            bool wasCancelled = false;

            // Extract arguments passed to the thread
            ExportWorkItem workItem = parameters as ExportWorkItem;

            // We are exporting
            workItem.ParentDialog.IsExporting = true;

            try
            {
                // We start exporting artifacts
                workItem.ParentDialog.Invoke(new OnNotifyArtifactExportBegin(workItem.ParentDialog.NotifyArtifactExportBegin), new object[] { workItem.Artifacts });

                // Export all artifacts
                foreach (DecompiledArtifact artifact in workItem.Artifacts)
                {
                    // Are we asked to cancel?
                    if (CancelEvent.WaitOne(0, false))
                    {
                        wasCancelled = true;
                        break;
                    }

                    try
                    {
                        // Ensure the directory hierachy exists and export the artifact, formatting it
                        string path = ComputeAndEnsureOutputPathHierachy(workItem.BasePath, artifact);
                        ExportFormattedXml(path, artifact);

                        System.Threading.Thread.Sleep(2000);

                        // Provide visual feedback to user
                        workItem.ParentDialog.Invoke(new OnNotifyArtifactExported(workItem.ParentDialog.NotifyArtifactExported), new object[] { path, artifact });
                    }
                    catch (Exception exp)
                    {
                        workItem.ParentDialog.Invoke(new OnNotifyExportError(workItem.ParentDialog.NotifyExportError), new object[] { exp, artifact });
                    }
                }

                // We are done exporting artifacts
                workItem.ParentDialog.Invoke(new OnNotifyArtifactExportEnd(workItem.ParentDialog.NotifyArtifactExportEnd), new object[] { wasCancelled });
            }
            finally
            {
                // We are not exporting anymore
                workItem.ParentDialog.IsExporting = false;
            }
        }