private void btnSessionImportStart_Click(object sender, EventArgs e)
        {
            // Validate the session filename.
            blockSubmitIfValidationFails = true;
            try
            {
                txtSessionFileName.Focus();
                if (!Validate())
                {
                    return;
                }
            }
            finally
            {
                blockSubmitIfValidationFails = false;
            }

            // Do UI changes, e.g. hide Start button, show Stop button, start progress bar.
            btnSessionImportStart.Visible = false;
            btnSessionImportStop.Visible  = true;
            progressBar.Value             = 0;
            progressBar.Visible           = true;

            // Start importer in another thread.
            sessionImporter                  = new SessionImporter(txtSessionFileName.Text);
            sessionImporter.Completed       += new CompletedEventHandler(SessionImportFinished);
            sessionImporter.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged);
            ThreadPool.QueueUserWorkItem(new WaitCallback(sessionImporter.Import));
        }
        /// <summary>
        /// Event handler that gets called when the session import is finished.
        /// </summary>
        private void SessionImportFinished(object sender, CompletedEventArgs args)
        {
            ImportResult result = args.Result;
            sessionImporter = null;
            Invoke((Action)(() =>
            {
                btnSessionImportStart.Visible = true;
                btnSessionImportStop.Visible = false;
                progressBar.Visible = false;

                ImportResultsPopup popup = new ImportResultsPopup(result);
                popup.ShowDialog();
            }));
        }