private void UpdateProxyUsingInfo(object sender, ProxyUsingChangedEvnetHandlerArgs args) { ProxyInfo pi = ins.SelectiveProxyGuide.CurrentProxyInfo; if (pi != null) { this.lblProxyAddress.Text = pi.ProxyAddress; this.lblProxyLatency.Text = "(" + pi.RTT + " ms)"; this.lblProxySource.Text = pi.Location; double per = (double)pi.RTT / 2000; if (per > 1) { per = 1; } Color c = Color.FromArgb((int)(0xff * per), (int)(0xff * (1.0 - per)), 0); this.lblProxyColor.BackColor = c; this.lblProxyStatusWorkingProxy.Text = pi.ProxyAddress; Log("Using Proxy: " + this.lblProxyAddress.Text); } else { this.lblProxyAddress.Text = "No Proxy Working"; this.lblProxyStatusWorkingProxy.Text = "No Proxy Working"; this.lblProxyLatency.Text = ""; this.lblProxySource.Text = ""; this.lblProxyColor.BackColor = Color.Red; Log(this.lblProxyAddress.Text); } }
private void DoProxyUsingChanged(object sender, ProxyUsingChangedEvnetHandlerArgs args) { try { this.lblProxyAddress.BeginInvoke(new Del5(UpdateProxyUsingInfo), new object[] { sender, args }); } catch (Exception) { } }