fix / suppress all remaining errors
This commit is contained in:
parent
35337cf3ea
commit
0bd7c40af2
9 changed files with 333 additions and 9200 deletions
WebBrowser
|
@ -8,6 +8,7 @@ using System.IO;
|
|||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using Timer = System.Threading.Timer;
|
||||
// ReSharper disable NotAccessedField.Local
|
||||
|
||||
namespace XeroBrowser
|
||||
{
|
||||
|
@ -17,26 +18,26 @@ namespace XeroBrowser
|
|||
|
||||
public event EventHandler<DownloadItem> OnDownloadUpdatedFired;
|
||||
|
||||
public FrmBrowser Frmref;
|
||||
private readonly FrmBrowser _frmref;
|
||||
public DownloadHandler(FrmBrowser frm)
|
||||
{
|
||||
Frmref = frm;
|
||||
_frmref = frm;
|
||||
}
|
||||
|
||||
public DownloadProgress DownloadProgress = new DownloadProgress();
|
||||
public DownloadItem DownloadItem;
|
||||
private readonly DownloadProgress _downloadProgress = new DownloadProgress();
|
||||
private DownloadItem _downloadItem;
|
||||
public void OnBeforeDownload(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IBeforeDownloadCallback callback)
|
||||
{
|
||||
OnBeforeDownloadFired?.Invoke(this, downloadItem);
|
||||
|
||||
this.DownloadItem = downloadItem;
|
||||
this._downloadItem = downloadItem;
|
||||
|
||||
try
|
||||
{
|
||||
Frmref.Invoke((Action)delegate
|
||||
_frmref.Invoke((Action)delegate
|
||||
{
|
||||
DownloadProgress.Show();
|
||||
DownloadProgress.FormClosing += DownloadProgress_FormClosing;
|
||||
_downloadProgress.Show();
|
||||
_downloadProgress.FormClosing += DownloadProgress_FormClosing;
|
||||
});
|
||||
}
|
||||
catch (ObjectDisposedException){}
|
||||
|
@ -53,10 +54,10 @@ namespace XeroBrowser
|
|||
|
||||
private void DownloadProgress_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
DownloadItem.IsCancelled = true;
|
||||
_downloadItem.IsCancelled = true;
|
||||
}
|
||||
|
||||
public Timer Fivesecondtimer;
|
||||
private Timer _fivesecondtimer;
|
||||
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, IDownloadItemCallback callback)
|
||||
{
|
||||
OnDownloadUpdatedFired?.Invoke(this, downloadItem);
|
||||
|
@ -64,15 +65,15 @@ namespace XeroBrowser
|
|||
|
||||
if (downloadItem.IsComplete)
|
||||
{
|
||||
Fivesecondtimer = new Timer(tcallback, null, 1000 * 5, 1000 * 5);
|
||||
_fivesecondtimer = new Timer(tcallback, null, 1000 * 5, 1000 * 5);
|
||||
}
|
||||
|
||||
|
||||
Frmref.Invoke((Action)delegate {
|
||||
DownloadProgress.ProgressBar1.Value = downloadItem.PercentComplete;
|
||||
DownloadProgress.ProgressPrecentage.Text = downloadItem.PercentComplete + @"% " + (downloadItem.ReceivedBytes / 0x100000) + @"MB / " + (downloadItem.TotalBytes / 0x100000) + @"MB";
|
||||
DownloadProgress.ProgressFileName.Text = Path.GetFileName(downloadItem.FullPath);
|
||||
DownloadProgress.Update();
|
||||
_frmref.Invoke((Action)delegate {
|
||||
_downloadProgress.ProgressBar1.Value = downloadItem.PercentComplete;
|
||||
_downloadProgress.ProgressPrecentage.Text = downloadItem.PercentComplete + @"% " + (downloadItem.ReceivedBytes / 0x100000) + @"MB / " + (downloadItem.TotalBytes / 0x100000) + @"MB";
|
||||
_downloadProgress.ProgressFileName.Text = Path.GetFileName(downloadItem.FullPath);
|
||||
_downloadProgress.Update();
|
||||
try { } catch (InvalidAsynchronousStateException){}
|
||||
});
|
||||
}
|
||||
|
@ -80,12 +81,12 @@ namespace XeroBrowser
|
|||
private void tcallback(object state)
|
||||
{
|
||||
try {
|
||||
Frmref.Invoke((Action)delegate
|
||||
_frmref.Invoke((Action)delegate
|
||||
{
|
||||
DownloadProgress.Close();
|
||||
_downloadProgress.Close();
|
||||
});
|
||||
}
|
||||
catch (InvalidOperationException){}
|
||||
}
|
||||
catch (InvalidOperationException){}
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue