protected override void OnLoad(EventArgs e) { if (Program.Setting.SaveFolder != null) { this.backgroundWorker1.ReportProgress(0); this.sync = new Synchronizer(this.webBrowser1, new Synchronizer.ReportProgressCallback(this.backgroundWorker1.ReportProgress)); } base.OnLoad(e); }
public Synchronizer(WebBrowser br, Synchronizer.ReportProgressCallback c) { this.callback = new Synchronizer.ReportProgressCallback(c.Invoke); this.browser = br; this.browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(this.browser_DocumentCompleted); this.client = new WebClient(); this.client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(this.client_DownloadProgressChanged); this.client.DownloadFileCompleted += new AsyncCompletedEventHandler(this.Client_DownloadFileCompleted); }