public void RunSpeedTest() { void log(string msg) { SendLog(msg); SetPropertyOnDemand(ref status, msg); } var port = Lib.Utils.GetFreeTcpPort(); var config = PrepareSpeedTestConfig(port); if (string.IsNullOrEmpty(config)) { log(I18N("DecodeImportFail")); return; } var url = StrConst("SpeedTestUrl"); var text = I18N("Testing") + " ..."; log(text); SendLog(url); var speedTester = new Model.BaseClass.CoreServer(); speedTester.OnLog += OnLogHandler; speedTester.RestartCore(config); var time = Lib.Utils.VisitWebPageSpeedTest(url, port); text = string.Format("{0}:{1}", I18N("VisitWebPageTest"), time > 0 ? time.ToString() + "ms" : I18N("Timeout")); log(text); speedTester.StopCore(); speedTester.OnLog -= OnLogHandler; }
private void btnRestart_Click(object sender, EventArgs e) { tester.RestartCore(cboxServList.SelectedIndex); this.Text = string.Format("{0} - {1}", formTitle, cboxServList.Text); }