public MainWindow() { InitializeComponent(); Loaded += MainWindow_Loaded; ww = new WaitWorker(UpdatePreview, 0.5); tb_source.TextChanged += Tb_source_TextChanged; Closed += MainWindow_Closed; }
static void Main(string[] args) { var activity = new WaitWorker(); activity.Main(); }
internal Dictionary <string, string> GeneratePostData(string[] keys, Dictionary <string, string> seedParams = null) { Dictionary <string, string> postData = new Dictionary <string, string>(); if (seedParams != null) { seedParams.Keys.ToList().ForEach(key => postData.Add(key, seedParams[key])); } foreach (string key in keys) { if (postData.ContainsKey(key)) { continue; } switch (key.ToLower()) { case "jvmroute": postData.Add(key, JvmRoute); break; case "balancer": if (!string.IsNullOrEmpty(Balancer)) { postData.Add(key, Balancer); } break; case "domain": if (!string.IsNullOrEmpty(Domain)) { postData.Add(key, Domain); } break; case "host": if (!string.IsNullOrEmpty(Host)) { postData.Add(key, Host); } break; case "port": postData.Add(key, Port.ToString()); break; case "type": if (!string.IsNullOrEmpty(Type)) { postData.Add(key, Type); } break; case "alias": if (!string.IsNullOrEmpty(Alias)) { postData.Add(key, Alias); } break; case "stickysession": postData.Add(key, (StickySession ? "yes" : "no")); break; case "stickysessionforce": postData.Add(key, (StickySessionForce ? "yes" : "no")); break; case "stickysessionremove": postData.Add(key, (StickySessionRemove ? "yes" : "no")); break; case "flushpackets": postData.Add(key, (FlushPackets ? "on" : "off")); break; case "waitworker": postData.Add(key, WaitWorker.ToString()); break; case "flushwait": postData.Add(key, Math.Floor(FlushWait.TotalSeconds).ToString()); break; case "maxattempts": postData.Add(key, MaxAttempts.ToString()); break; case "stickysessioncookie": if (!string.IsNullOrEmpty(StickySessionCookie)) { postData.Add(key, StickySessionCookie); } break; case "stickysessionpath": if (!string.IsNullOrEmpty(StickySessionPath)) { postData.Add(key, StickySessionPath); } break; case "ping": postData.Add("ping", Math.Floor(Ping.TotalSeconds).ToString()); break; case "smax": if (Smax.HasValue) { postData.Add(key, Smax.ToString()); } break; case "ttl": postData.Add(key, Math.Floor(Ttl.TotalSeconds).ToString()); break; case "timeout": postData.Add(key, Math.Floor(Timeout.TotalSeconds).ToString()); break; default: throw new InvalidProgramException("Cannot map value " + key); } } return(postData); }