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); }
protected override void OnClick(EventArgs e) { base.OnClick (e); try { BlogEditingTemplateDetector detector = new BlogEditingTemplateDetector(this); detector.SetContext( "http://localhost/test/editingTemplate.htm", @"C:\Program Files\Apache Group\Apache\htdocs\test\blogtemplates" ); detector.DetectTemplate(SilentProgressHost.Instance) ; Trace.WriteLine(detector.BlogTemplateFile); } catch(Exception ex) { UnexpectedErrorMessage.Show( ex ) ; } }
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 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 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); }