private void createMenus() { testOptions = new MenuOptions <TestOption>("testOptionMenu", menuFlyout, option => { testOption = option; resetButton_Click(null, null); }); testOptions.addOption(TestOption.Random, "Random gibberish words", false); testOptions.addOption(TestOption.Word1k, "Random words (most used 1k)", true); testOptions.addOption(TestOption.Word100k, "Random Words (100k)", false); testOptions.addOption(TestOption.Word500k, "Random Words (500k)", false); testOptions.updateMenu(); clockOptions = new MenuOptions <ClockOption>("clockOptionMenu", clockMenuFlyout, option => { switch (option) { case ClockOption.OneMinute: timerDuration = 60 * 1000; break; case ClockOption.ThreeMinute: timerDuration = 3 * 60 * 1000; break; case ClockOption.FiveMinute: timerDuration = 5 * 60 * 1000; break; case ClockOption.TenMinute: timerDuration = 10 * 60 * 1000; break; } }); clockOptions.addOption(ClockOption.OneMinute, "One minute test", true); clockOptions.addOption(ClockOption.ThreeMinute, "Three minute test", false); clockOptions.addOption(ClockOption.FiveMinute, "Five minute test", false); clockOptions.addOption(ClockOption.TenMinute, "Ten minute test", false); clockOptions.updateMenu(); }
public ActionResult Delete(string id) { TestOption option = _testOptionRepository.Get(id); return(View(option)); }
/// <summary> /// 验证代理 /// </summary> private void TestSingleProxy() { DelegateVoid delegateVoid = EnableThis; Invoke(delegateVoid); Config.MainForm.SetStatusText(Config.LocalLanguage.Messages.Testing); var sw = new Stopwatch(); sw.Start(); HttpProxy httpProxy = GetProxySetting(); var model = new ProxyServer { port = httpProxy.Port, proxy = httpProxy.Ip }; try { model.description = Config.LocalLanguage.Messages.Testing; model.status = -1; var testOption = new TestOption(); #region 读取验证配置 if (Config.LocalSetting != null && Config.LocalSetting.DefaultTestOption != null) { testOption = Config.LocalSetting.DefaultTestOption; } #endregion if (Config.LocalSetting != null && new TestProxyHelper(testOption, Config.LocalSetting.TestTimeOut, Config.LocalSetting.UserAgent).TestProxy(httpProxy).IsAlive) { sw.Stop(); Config.MainForm.SetStatusText( string.Format( Config.LocalLanguage.Messages.ProxyIsAlive + "!" + Config.LocalLanguage.Messages.TimeConsuming, sw.ElapsedMilliseconds.ToString("F0"))); model.description = sw.ElapsedMilliseconds + "ms"; model.response = int.Parse(sw.ElapsedMilliseconds + ""); model.status = 1; ProxyData.Set(model); } else { Config.MainForm.SetStatusText(Config.LocalLanguage.Messages.ProxyIsDead); model.description = Config.LocalLanguage.Messages.ProxyIsDead; model.response = 99999; model.status = 0; ProxyData.Set(model); } } catch (Exception ex) { try { model.status = 0; model.response = 99999; model.description = ex.Message; Config.MainForm.SetStatusText(ex.Message); } catch { } } finally { Invoke(delegateVoid); } }
private bool Contains(Setting localSetting, TestOption testEntity) { return(localSetting.TestOptionsList.Any(te => te.TestUrl.ToLower() == testEntity.TestUrl.ToLower())); }