/// <summary> /// 测试节点延迟 /// </summary> private void TestLine() { Task.Run(new Action(() => { string hostname = EncryptsHelper.Decrypt(shadowsocksR.HostName); int result = int.Parse(NetWorkHelper.GetIPPing(hostname)); if (result > 0 && result < 100) { lbPingText.ForeColor = Color.LimeGreen; } else if (result > 90 && result < 200) { lbPingText.ForeColor = Color.Yellow; } else if (result == 0 || result >= 200) { lbPingText.ForeColor = Color.Red; } if (lbPingText.InvokeRequired) { lbPingText.BeginInvoke(new Action(() => { lbPingText.Text = result.ToString() + " ms"; })); } })); }
/// <summary> /// 测试延迟 /// </summary> private void TestIP() { Task.Run(new Action(() => { foreach (SkinListBoxItem item in skinListBox1.Items) { string hostname = item.Tag.ToString(); string remark = ssList[hostname]; string result = NetWorkHelper.GetIPPing(hostname); item.Text = remark + " " + result + " ms"; } })); }