public static DialogResult ExecuteWithProgress(string title, ProgressOperation operation, ISynchronizeInvoke synchronizeInvoke, IWin32Window owner)
        {
            using (ProgressDialog progress = new ProgressDialog())
            {
                progress.Text = title;
                MultipartAsyncOperation async = new MultipartAsyncOperation(synchronizeInvoke);
                async.AddProgressOperation(operation, new ProgressCategory(null, null), 100);
                progress.ProgressProvider = async;
                async.Start();

                DialogResult result;
                if (!async.IsDone)
                    result = progress.ShowDialog(owner);
                else
                    result = progress.DialogResult;

                if (result == DialogResult.Cancel)
                    throw new OperationCancelledException();
                else if (result == DialogResult.Abort)
                    throw async.Exception;
                else
                    return result;
            }
        }
        public OpenLiveWriter.CoreServices.AsyncOperation CreateOperation(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, TemporaryBlogSettings temporarySettings)
        {
            // save references
            _uiContext = uiContext;
            _temporarySettings = temporarySettings;

            // create operation
            _hostOperation = new MultipartAsyncOperation(uiContext);
            _hostOperation.AddProgressOperation(new ProgressOperation(DetectWeblogSettings), 50);
            _blogEditingTemplateDetector = new BlogEditingTemplateDetector(_uiContext, hiddenBrowserParentControl, temporarySettings, false);
            _hostOperation.AddProgressOperation(new ProgressOperation(_blogEditingTemplateDetector.DetectTemplate), 50);
            return _hostOperation;
        }