private void ThreadMain(ConditionVariable signal, string[] ids)
        {
            HtmlScreenCaptureForm form = null;

            try
            {
                // housekeeping initialization
                Application.OleRequired();

                // create the form and execute the capture
                form     = new HtmlScreenCaptureForm(this);
                this.Ids = ids;
                form.Ids = ids;
                form.DoCapture();

                // Create and run the form
                _applicationContext = new FormLifetimeApplicationContext(form);
                signal.Signal();
                Application.Run(_applicationContext);

                // propragate exceptions that happened inside the AppContext
                if (_applicationContext.Exception != null)
                {
                    throw _applicationContext.Exception;
                }
            }
            catch (Exception ex)
            {
                _exception = ex;
            }
            finally
            {
                if (form != null)
                {
                    form.Close();
                }
            }
        }
        private void ThreadMain(ConditionVariable signal, string[] ids)
        {
            HtmlScreenCaptureForm form = null;
            try
            {
                // housekeeping initialization
                Application.OleRequired();

                // create the form and execute the capture
                form = new HtmlScreenCaptureForm(this);
                this.Ids = ids;
                form.Ids = ids;
                form.DoCapture();

                // Create and run the form
                _applicationContext = new FormLifetimeApplicationContext(form);
                signal.Signal();
                Application.Run(_applicationContext);

                // propragate exceptions that happened inside the AppContext
                if (_applicationContext.Exception != null)
                    throw _applicationContext.Exception;
            }
            catch (Exception ex)
            {
                _exception = ex;
            }
            finally
            {
                if (form != null)
                    form.Close();
            }
        }