private void ConnectToFile(Uri URL, string Filename, object token, bool trySimpler) { try { wsFile = new WebClientCore(); wsFile.KeepAlive = false; wsFile.ErrorBypass = true; wsFile.ManualRedirect = false; System.Threading.Timer tmrSocket = new System.Threading.Timer(new TimerCallback(DownloadFile), new object[] { URL, Filename, token, trySimpler }, 250, System.Threading.Timeout.Infinite); tmrSocket.GetType(); } catch { c_callback.Invoke(Gdk.Pixbuf.LoadFromResource("RestrictionTrackerGTK.Resources.error.png"), Gdk.Pixbuf.LoadFromResource("RestrictionTrackerGTK.Resources.config.linux.advanced_nettest_error.png"), token, new Exception(" Failed to initialize connection to \"" + URL.OriginalString + "\"!")); } }
public void CheckVersion() { AppSettings myS = new AppSettings(); wsVer = new RestrictionLibrary.WebClientCore(); wsVer.DownloadProgressChanged += wsVer_DownloadProgressChanged; wsVer.DownloadStringCompleted += wsVer_DownloadStringCompleted; wsVer.DownloadFileCompleted += wsVer_DownloadFileCompleted; wsVer.KeepAlive = false; wsVer.Proxy = myS.Proxy; wsVer.Timeout = myS.Timeout; myS = null; wsVer.DownloadStringAsync(new Uri(VersionURL), "INFO"); if (CheckingVersion != null) { CheckingVersion(this, new EventArgs()); } }
protected virtual void Dispose(bool disposing) { if (!this.disposedValue) { if (disposing) { if (wsFile != null) { if (wsFile.IsBusy) { wsFile.CancelAsync(); } wsFile.Dispose(); wsFile = null; } } } this.disposedValue = true; }