Beispiel #1
0
        public BlogServiceDetectorBase(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, string localBlogId, string homepageUrl, IBlogCredentialsAccessor credentials)
            : base(uiContext)
        {
            // save references
            _uiContext   = uiContext;
            _localBlogId = localBlogId;
            _homepageUrl = homepageUrl;
            _credentials = credentials;

            // add blog service detection
            AddProgressOperation(
                new ProgressOperation(DetectBlogService),
                35);

            // add settings downloading (note: this operation will be a no-op
            // in the case where we don't successfully detect a weblog)
            AddProgressOperation(
                new ProgressOperation(DetectWeblogSettings),
                new ProgressOperationCompleted(DetectWeblogSettingsCompleted),
                30);

            // add template downloading (note: this operation will be a no-op in the
            // case where we don't successfully detect a weblog)
            _blogEditingTemplateDetector = new BlogEditingTemplateDetector(uiContext, hiddenBrowserParentControl);
            AddProgressOperation(
                new ProgressOperation(_blogEditingTemplateDetector.DetectTemplate),
                35);
        }
 public GetRecentPostOperation(IBlogClientUIContext uiContext, string blogId, BlogPost blogPost)
     : base(uiContext)
 {
     _uiContext = uiContext;
     _blogId    = blogId;
     _blogPost  = blogPost;
 }
 public UpdateWeblogAsyncOperation(IBlogClientUIContext uiContext, IBlogPostPublishingContext publishingContext, bool publish)
     : base(uiContext)
 {
     _uiContext         = uiContext;
     _publishingContext = publishingContext;
     _publish           = publish;
 }
 public UpdateWeblogAsyncOperation(IBlogClientUIContext uiContext, IBlogPostPublishingContext publishingContext, bool publish)
     : base(uiContext)
 {
     _uiContext = uiContext;
     _publishingContext = publishingContext;
     _publish = publish;
 }
        public BlogEditingTemplateDetector(IBlogClientUIContext uiContext, Control parentControl, IBlogSettingsAccessor blogSettings, bool probeForManifest)
            : this(uiContext, parentControl)
        {
            BlogAccount blogAccount     = new BlogAccount(blogSettings.ServiceName, blogSettings.ClientType, blogSettings.PostApiUrl, blogSettings.HostBlogId);
            string      blogTemplateDir = BlogEditingTemplate.GetBlogTemplateDir(blogSettings.Id);

            SetContext(blogAccount, blogSettings.Credentials, blogSettings.HomepageUrl, blogTemplateDir, blogSettings.ManifestDownloadInfo, probeForManifest, blogSettings.ProviderId, blogSettings.OptionOverrides, blogSettings.UserOptionOverrides, blogSettings.HomePageOverrides);
        }
Beispiel #6
0
 public GetRecentPostsAsyncOperation(IBlogClientUIContext uiContext, IPostEditorPostSource postSource, RecentPostRequest request, bool getPages)
     : base(uiContext)
 {
     _uiContext  = uiContext;
     _postSource = postSource;
     _request    = request;
     _getPages   = getPages;
 }
Beispiel #7
0
        public WizardSharePointAutoDetectionStep(
            IBlogClientUIContext uiContext,
            TemporaryBlogSettings temporarySettings,
            WizardController.NextCallback nextHandler,
            IWizardAutoDetectionOperation autoDetectionOperation)

            : base(uiContext, temporarySettings, nextHandler, autoDetectionOperation)
        {
        }
        public WizardSharePointAutoDetectionStep(
            IBlogClientUIContext uiContext,
            TemporaryBlogSettings temporarySettings,
            WizardController.NextCallback nextHandler,
            IWizardAutoDetectionOperation autoDetectionOperation)

            : base(uiContext, temporarySettings, nextHandler, autoDetectionOperation)
        {
        }
        public virtual OpenLiveWriter.CoreServices.AsyncOperation CreateOperation(IBlogClientUIContext uiContext, Control parentControl, TemporaryBlogSettings temporarySettings)
        {
            _temporarySettings = temporarySettings;

            // create and start the account detector
            _blogServiceDetector = new BlogServiceDetector(
                uiContext,
                parentControl,
                _temporarySettings,
                new BlogCredentialsAccessor(_temporarySettings.Id, _temporarySettings.Credentials));

            return _blogServiceDetector;
        }
Beispiel #10
0
        public virtual OpenLiveWriter.CoreServices.AsyncOperation CreateOperation(IBlogClientUIContext uiContext, Control parentControl, TemporaryBlogSettings temporarySettings)
        {
            _temporarySettings = temporarySettings;

            // create and start the account detector
            _blogServiceDetector = new BlogServiceDetector(
                uiContext,
                parentControl,
                _temporarySettings,
                new BlogCredentialsAccessor(_temporarySettings.Id, _temporarySettings.Credentials));

            return(_blogServiceDetector);
        }
Beispiel #11
0
        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);
        }
        public static IDisposable ShowWaitCursor()
        {
            IBlogClientUIContext uiContext = BlogClientUIContext.ContextForCurrentThread;

            if (uiContext != null && !uiContext.InvokeRequired)
            {
                return(new WaitCursor());
            }
            else
            {
                return(null);
            }
        }
Beispiel #13
0
        public WizardAutoDetectionStep(
            IBlogClientUIContext uiContext,
            TemporaryBlogSettings temporarySettings,
            WizardController.NextCallback nextHandler,
            IWizardAutoDetectionOperation autoDetectionOperation)

            : base(new WeblogConfigurationWizardPanelAutoDetection(),
                   StringId.ConfigWizardDetectSettings,
                   null, null, nextHandler, null, null)
        {
            _uiContext              = uiContext;
            _temporarySettings      = temporarySettings;
            _autoDetectionOperation = autoDetectionOperation;
        }
        public WizardAutoDetectionStep(
            IBlogClientUIContext uiContext,
            TemporaryBlogSettings temporarySettings,
            WizardController.NextCallback nextHandler,
            IWizardAutoDetectionOperation autoDetectionOperation)

            : base(new WeblogConfigurationWizardPanelAutoDetection(),
                    StringId.ConfigWizardDetectSettings,
                    null, null, nextHandler, null, null)
        {
            _uiContext = uiContext;
            _temporarySettings = temporarySettings;
            _autoDetectionOperation = autoDetectionOperation;
        }
        public static BlogEditingTemplateFile[] DetectTemplate(IBlogClientUIContext uiContext, Control parentControl, IBlogSettingsAccessor blogSettings, bool probeForManifest, out Color?postBodyBackgroundColor)
        {
            postBodyBackgroundColor = null;

            try
            {
                // create a new detector
                BlogEditingTemplateDetector detector = new BlogEditingTemplateDetector(uiContext, parentControl, blogSettings, probeForManifest);

                // execute with a progress dialog
                ProgressHelper.ExecuteWithProgress(
                    Res.Get(StringId.DownloadingWeblogStyle),
                    new ProgressOperation(detector.DetectTemplate),
                    uiContext,
                    uiContext);

                // propagate exception
                if (detector.ExceptionOccurred)
                {
                    throw detector.Exception;
                }

                postBodyBackgroundColor = detector.PostBodyBackgroundColor;
                // return the template
                return(detector.BlogTemplateFiles);
            }
            catch (OperationCancelledException)
            {
                return(new BlogEditingTemplateFile[0]);
            }
            catch (BlogClientOperationCancelledException)
            {
                Debug.WriteLine("BlogClient operation cancelled");
                return(new BlogEditingTemplateFile[0]);
            }
            catch (Exception e)
            {
                Trace.Fail("Error occurred while downloading weblog style" + e.ToString());
                DisplayMessage.Show(MessageId.TemplateDownloadFailed);
                return(new BlogEditingTemplateFile[0]);
            }
        }
        public static BlogEditingTemplateFile[] DetectTemplate(IBlogClientUIContext uiContext, Control parentControl, IBlogSettingsAccessor blogSettings, bool probeForManifest, out Color? postBodyBackgroundColor)
        {
            postBodyBackgroundColor = null;

            try
            {
                // create a new detector
                BlogEditingTemplateDetector detector = new BlogEditingTemplateDetector(uiContext, parentControl, blogSettings, probeForManifest);

                // execute with a progress dialog
                ProgressHelper.ExecuteWithProgress(
                    Res.Get(StringId.DownloadingWeblogStyle),
                    new ProgressOperation(detector.DetectTemplate),
                    uiContext,
                    uiContext);

                // propagate exception
                if (detector.ExceptionOccurred)
                    throw detector.Exception;

                postBodyBackgroundColor = detector.PostBodyBackgroundColor;
                // return the template
                return detector.BlogTemplateFiles;
            }
            catch (OperationCancelledException)
            {
                return new BlogEditingTemplateFile[0];
            }
            catch (BlogClientOperationCancelledException)
            {
                Debug.WriteLine("BlogClient operation cancelled");
                return new BlogEditingTemplateFile[0];
            }
            catch (Exception e)
            {
                Trace.Fail("Error occurred while downloading weblog style" + e.ToString());
                DisplayMessage.Show(MessageId.TemplateDownloadFailed);
                return new BlogEditingTemplateFile[0];
            }

        }
        public static CredentialsPromptResult PromptForCredentials(ref string username, ref string password, ICredentialsDomain domain)
        {
            CredentialsPromptResult result;

            if (BlogClientUIContext.SilentModeForCurrentThread)
            {
                return(CredentialsPromptResult.Abort);
            }

            IBlogClientUIContext uiContext = BlogClientUIContext.ContextForCurrentThread;

            if (uiContext != null)
            {
                PromptHelper promptHelper = new PromptHelper(uiContext, username, password, domain);
                if (uiContext.InvokeRequired)
                {
                    uiContext.Invoke(new InvokeInUIThreadDelegate(promptHelper.ShowPrompt), new object[0]);
                }
                else
                {
                    promptHelper.ShowPrompt();

                    //force a UI loop so that the dialog closes without hanging while post-dialog logic executes
                    Application.DoEvents();
                }

                result = promptHelper.Result;
                if (result != CredentialsPromptResult.Cancel)
                {
                    username = promptHelper.Username;
                    password = promptHelper.Password;
                }
            }
            else
            {
                result = CredentialsPromptResult.Abort;
            }
            return(result);
        }
        public static DialogResult ShowDisplayMessageOnUIThread(MessageId messageId, params object[] parameters)
        {
            IBlogClientUIContext uiContext = ContextForCurrentThread;

            if (uiContext == null)
            {
                Trace.Fail("BlogClientUIContext.ShowDisplayMessageOnUIThread called without a context in scope!");
                return(DialogResult.None);
            }

            DisplayMessageHelper dmh = new DisplayMessageHelper(uiContext, messageId, parameters);

            if (uiContext.InvokeRequired)
            {
                uiContext.Invoke(new ThreadStart(dmh.Handler), null);
            }
            else
            {
                dmh.Handler();
            }
            return(dmh.DialogResult);
        }
 public BlogServiceDetector(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, string localBlogId, string homepageUrl, IBlogCredentialsAccessor credentials)
     : base(uiContext, hiddenBrowserParentControl, localBlogId, homepageUrl, credentials)
 {
 }
 /// <summary>
 /// Initialize BlogTemplateDetector without providing context (if you do not call
 /// one of the SetContext methods prior to executing the Start method then the
 /// BlogTemplateDetector will be a no-op that does not detect and download the template)
 /// </summary>
 /// <param name="parentControl"></param>
 public BlogEditingTemplateDetector(IBlogClientUIContext uiContext, Control parentControl)
 {
     _uiContext     = uiContext;
     _parentControl = parentControl;
 }
 public BlogEditingTemplateDetector(IBlogClientUIContext uiContext, Control parentControl, IBlogSettingsAccessor blogSettings, bool probeForManifest)
     : this(uiContext, parentControl)
 {
     BlogAccount blogAccount = new BlogAccount(blogSettings.ServiceName, blogSettings.ClientType, blogSettings.PostApiUrl, blogSettings.HostBlogId);
     string blogTemplateDir = BlogEditingTemplate.GetBlogTemplateDir(blogSettings.Id);
     SetContext(blogAccount, blogSettings.Credentials, blogSettings.HomepageUrl, blogTemplateDir, blogSettings.ManifestDownloadInfo, probeForManifest, blogSettings.ProviderId, blogSettings.OptionOverrides, blogSettings.UserOptionOverrides, blogSettings.HomePageOverrides);
 }
 public BlogClientUIContextScope(IBlogClientUIContext uiContext)
 {
     _previousUIContext = BlogClientUIContext.ContextForCurrentThread;
     BlogClientUIContext.ContextForCurrentThread = uiContext;
 }
        public override OpenLiveWriter.CoreServices.AsyncOperation CreateOperation(IBlogClientUIContext uiContext, Control parentConrol, TemporaryBlogSettings temporarySettings)
        {
            _temporarySettings = temporarySettings;

            // create and start the account detector
            _blogServiceDetector = new SharePointBlogDetector(
                uiContext,
                parentConrol,
                _temporarySettings.Id, _temporarySettings.HomepageUrl,
                new BlogCredentialsAccessor(_temporarySettings.Id, _temporarySettings.Credentials),
                _temporarySettings.Credentials);

            return _blogServiceDetector;
        }
        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;
        }
 public GetRecentPostOperation(IBlogClientUIContext uiContext, string blogId, BlogPost blogPost)
     : base(uiContext)
 {
     _uiContext = uiContext;
     _blogId = blogId;
     _blogPost = blogPost;
 }
 public GetRecentPostsAsyncOperation(IBlogClientUIContext uiContext, IPostEditorPostSource postSource, RecentPostRequest request, bool getPages)
     : base(uiContext)
 {
     _uiContext = uiContext;
     _postSource = postSource;
     _request = request;
     _getPages = getPages;
 }
 public BlogServiceDetector(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, IBlogSettingsAccessor blogSettings, IBlogCredentialsAccessor credentials)
     : base(uiContext, hiddenBrowserParentControl, blogSettings.Id, blogSettings.HomepageUrl, credentials)
 {
     _blogSettings = blogSettings;
 }
 public SharePointBlogDetector(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, string localBlogId, string homepageUrl, IBlogCredentialsAccessor credentials, IBlogCredentials blogCredentials)
     : base(uiContext, hiddenBrowserParentControl, localBlogId, homepageUrl, credentials)
 {
     _blogCredentials = blogCredentials;
 }
        public BlogServiceDetectorBase(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, string localBlogId, string homepageUrl, IBlogCredentialsAccessor credentials)
            : base(uiContext)
        {
            // save references
            _uiContext = uiContext;
            _localBlogId = localBlogId;
            _homepageUrl = homepageUrl;
            _credentials = credentials;

            // add blog service detection
            AddProgressOperation(
                new ProgressOperation(DetectBlogService),
                35);

            // add settings downloading (note: this operation will be a no-op
            // in the case where we don't succesfully detect a weblog)
            AddProgressOperation(
                new ProgressOperation(DetectWeblogSettings),
                new ProgressOperationCompleted(DetectWeblogSettingsCompleted),
                30);

            // add template downloading (note: this operation will be a no-op in the
            // case where we don't successfully detect a weblog)
            _blogEditingTemplateDetector = new BlogEditingTemplateDetector(uiContext, hiddenBrowserParentControl);
            AddProgressOperation(
                new ProgressOperation(_blogEditingTemplateDetector.DetectTemplate),
                35);
        }
Beispiel #30
0
 public BlogServiceDetector(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, IBlogSettingsAccessor blogSettings, IBlogCredentialsAccessor credentials)
     : base(uiContext, hiddenBrowserParentControl, blogSettings.Id, blogSettings.HomepageUrl, credentials)
 {
     _blogSettings = blogSettings;
 }
Beispiel #31
0
 public SharePointBlogDetector(IBlogClientUIContext uiContext, Control hiddenBrowserParentControl, string localBlogId, string homepageUrl, IBlogCredentialsAccessor credentials, IBlogCredentials blogCredentials)
     : base(uiContext, hiddenBrowserParentControl, localBlogId, homepageUrl, credentials)
 {
     _blogCredentials = blogCredentials;
 }
 public BlogClientUIContextScope(IBlogClientUIContext uiContext)
 {
     _previousUIContext = BlogClientUIContext.ContextForCurrentThread;
     BlogClientUIContext.ContextForCurrentThread = uiContext;
 }
 /// <summary>
 /// Initialize BlogTemplateDetector without providing context (if you do not call
 /// one of the SetContext methods prior to executing the Start method then the
 /// BlogTemplateDetector will be a no-op that does not detect and download the template)
 /// </summary>
 /// <param name="parentControl"></param>
 public BlogEditingTemplateDetector(IBlogClientUIContext uiContext, Control parentControl)
 {
     _uiContext = uiContext;
     _parentControl = parentControl;
 }