private static BlogPost SafeGetPostFromServer(IWin32Window mainFrameWindow, string destinationBlogId, BlogPost blogPost)
        {
            try
            {
                if (BlogSettings.BlogIdIsValid(destinationBlogId))
                {
                    string entityName = blogPost.IsPage ? Res.Get(StringId.Page) : Res.Get(StringId.Post);

                    if (!VerifyBlogCredentials(destinationBlogId))
                    {
                        // warn the user we couldn't synchronize
                        ShowRecentPostNotSynchronizedWarning(mainFrameWindow, entityName);
                        return(null);
                    }

                    // get the recent post (with progress if it takes more than a predefined interval)
                    GetRecentPostOperation getRecentPostOperation = null;
                    using (RecentPostProgressForm progressForm = new RecentPostProgressForm(entityName))
                    {
                        progressForm.CreateControl();
                        getRecentPostOperation = new GetRecentPostOperation(new BlogClientUIContextImpl(progressForm), destinationBlogId, blogPost);
                        getRecentPostOperation.Start();
                        progressForm.ShowDialogWithDelay(mainFrameWindow, getRecentPostOperation, 3000);
                    }

                    // if we got the post then return it
                    if (!getRecentPostOperation.WasCancelled && getRecentPostOperation.ServerBlogPost != null)
                    {
                        return(getRecentPostOperation.ServerBlogPost);
                    }
                    // remote server didn't have a copy of the post
                    else if (getRecentPostOperation.NoPostAvailable)
                    {
                        return(null);
                    }
                    // some type of error occurred (including the user cancelled)
                    else
                    {
                        // warn the user we couldn't synchronize
                        ShowRecentPostNotSynchronizedWarning(mainFrameWindow, entityName);
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Trace.Fail("Unexpected error attempting to fetch blog-post from server: " + ex.ToString());
                return(null);
            }
        }
        private static BlogPost SafeGetPostFromServer(IWin32Window mainFrameWindow, string destinationBlogId, BlogPost blogPost)
        {
            try
            {
                if (BlogSettings.BlogIdIsValid(destinationBlogId))
                {
                    string entityName = blogPost.IsPage ? Res.Get(StringId.Page) : Res.Get(StringId.Post);

                    if (!VerifyBlogCredentials(destinationBlogId))
                    {
                        // warn the user we couldn't synchronize
                        ShowRecentPostNotSynchronizedWarning(mainFrameWindow, entityName);
                        return null;
                    }

                    // get the recent post (with progress if it takes more than a predefined interval)
                    GetRecentPostOperation getRecentPostOperation = null;
                    using (RecentPostProgressForm progressForm = new RecentPostProgressForm(entityName))
                    {
                        progressForm.CreateControl();
                        getRecentPostOperation = new GetRecentPostOperation(new BlogClientUIContextImpl(progressForm), destinationBlogId, blogPost);
                        getRecentPostOperation.Start();
                        progressForm.ShowDialogWithDelay(mainFrameWindow, getRecentPostOperation, 3000);
                    }

                    // if we got the post then return it
                    if (!getRecentPostOperation.WasCancelled && getRecentPostOperation.ServerBlogPost != null)
                    {
                        return getRecentPostOperation.ServerBlogPost;
                    }
                    // remote server didn't have a copy of the post
                    else if (getRecentPostOperation.NoPostAvailable)
                    {
                        return null;
                    }
                    // some type of error occurred (including the user cancelled)
                    else
                    {
                        // warn the user we couldn't synchronize
                        ShowRecentPostNotSynchronizedWarning(mainFrameWindow, entityName);
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
            catch (Exception ex)
            {
                Trace.Fail("Unexpected error attempting to fetch blog-post from server: " + ex.ToString());
                return null;
            }
        }