/// <summary> /// This method is required for Windows Forms designer support. /// Do not change the method contents inside the source code editor. The Forms designer might /// not be able to load this method if it was changed manually. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WorkViewer)); this.webBrowser1 = new MarxistReader.SafeWebBrowser(); this.SuspendLayout(); // // webBrowser1 // this.webBrowser1.AllowWebBrowserDrop = false; this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill; this.webBrowser1.DownloadControlFlags = 0; this.webBrowser1.Location = new System.Drawing.Point(0, 0); this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20); this.webBrowser1.Name = "webBrowser1"; this.webBrowser1.Size = new System.Drawing.Size(1262, 955); this.webBrowser1.TabIndex = 0; this.webBrowser1.Url = new System.Uri("about:blank", System.UriKind.Absolute); this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.WebBrowser1DocumentCompleted); // // WorkViewer // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1262, 955); this.Controls.Add(this.webBrowser1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "WorkViewer"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "MarxistReader"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.WorkViewerFormClosing); this.Load += new System.EventHandler(this.WorkViewerLoad); this.ResumeLayout(false); }
public HtmlDocumentLoader(SafeWebBrowser webBrowser) { myBrowser = webBrowser; // always control the download settings webBrowser.DownloadControlFlags = DocumentLoaderFactory.DownloadControlFlags; }
public void OneTimeSetUp() { myBrowser = new SafeWebBrowser(); myBrowser.DownloadControlFlags = DocumentLoaderFactory.DownloadControlFlags; myBrowser.LoadHtml(GetHtml()); Document = new HtmlDocumentAdapter(myBrowser.Document); }
public WinFormsDocumentBrowser(INavigator navigator, SafeWebBrowser webBrowser) { myNavigator = navigator; // we have to send Navigating event also if user interacts with the real WebBrowser. // in order to not send event twice we ignore the events from Navigator //myNavigator.Navigating += OnNavigating; Browser = webBrowser; Browser.Navigating += WebBrowser_Navigating; Browser.DocumentCompleted += WebBrowser_DocumentCompleted; }
public static IDocumentLoader CreateLoader(DocumentType docType, SafeWebBrowser webBrowser) { if (docType == DocumentType.Html) { return(new RaynMaker.Modules.Import.Documents.WinForms.HtmlDocumentLoader(webBrowser)); } else { return(CreateLoader(docType)); } }
public void AddDataSource() { var storageService = new StorageService(myProjectHost.Object); var webSpy = new WebSpyViewModel(myProjectHost.Object, storageService, myLutService.Object); var browser = new SafeWebBrowser(); webSpy.Browser = browser; Assert.That(webSpy.Session.Sources, Is.Empty); Assert.That(webSpy.DataSourcesNavigation.AddDataSourceCommand.CanExecute(null), Is.True); webSpy.DataSourcesNavigation.AddDataSourceCommand.Execute(null); var dataSource = webSpy.Session.CurrentSource; dataSource.Vendor = "DummyVendor"; dataSource.Name = "DummyName"; dataSource.Quality = 1; webSpy.DocumentLocation.CaptureCommand.Execute(null); Assert.That(webSpy.DocumentLocation.IsCapturing, Is.True); var documentLocation = new Uri(Path.Combine(TestDataRoot, "html", "ariva.prices.DE0007664039.html")); browser.Load(documentLocation); webSpy.DocumentLocation.CaptureCommand.Execute(null); Assert.That(webSpy.DocumentLocation.IsCapturing, Is.False); Assert.That(dataSource.Location.Fragments.Count, Is.EqualTo(2)); Assert.That(dataSource.Location.Fragments.First().Url, Is.EqualTo(documentLocation)); webSpy.DataSourcesNavigation.DescriptorSelectionRequest.Raised += DescriptorSelectionRequest_Raised; webSpy.DataSourcesNavigation.AddFigureCommand.Execute(); webSpy.DataSourcesNavigation.DescriptorSelectionRequest.Raised -= DescriptorSelectionRequest_Raised; var figure = ( IPathDescriptor )webSpy.Session.CurrentFigureDescriptor; Assert.That(figure, Is.Not.Null); HtmlMarkupAutomationProvider.SimulateClickOn(browser.Document, "rym_FrakfurtPrice"); Assert.That(figure.Path, Is.EqualTo(@"/BODY[0]/DIV[0]/DIV[1]/DIV[6]/DIV[1]/DIV[0]/DIV[0]/TABLE[0]")); webSpy.SaveCommand.Execute(null); dataSource = storageService.Load().Single(); Assert.That(dataSource.Vendor, Is.EqualTo("DummyVendor")); Assert.That(dataSource.Name, Is.EqualTo("DummyName")); Assert.That(dataSource.Location.Fragments.First().Url, Is.EqualTo(documentLocation)); Assert.That((( IPathDescriptor )dataSource.Figures.Single()).Path, Is.EqualTo(@"/BODY[0]/DIV[0]/DIV[1]/DIV[6]/DIV[1]/DIV[0]/DIV[0]/TABLE[0]")); }
public void Dispose() { if (myBrowser == null) { return; } if (myOwnWebBrowser) { myBrowser.Dispose(); } myBrowser = null; }
public MyWebBrowserSite(SafeWebBrowser host) : base(host) { _host = host; }
/// <summary> /// Creates a new instance of the <see cref="ExtendedWebBrowserSite"/> class /// </summary> /// <param name="host">The <see cref="ExtendedWebBrowser"/> hosting the browser</param> public ExtendedWebBrowserSite(SafeWebBrowser host) : base(host) { _host = host; }
public void OneTimeSetUp() { myBrowser = new SafeWebBrowser(); myBrowser.DownloadControlFlags = DocumentLoaderFactory.DownloadControlFlags; }
public static IDocumentBrowser CreateBrowser(SafeWebBrowser webBrowser) { return(new WinFormsDocumentBrowser(CreateNavigator(), webBrowser)); }