public static void Main(string[] args) { Console.WriteLine("Start searching"); var configs = Greeter.Search(); var sel_addr = ""; var sel_config = new Config(); foreach (KeyValuePair <string, Config> config in configs) { Console.WriteLine("IP: " + config.Key); Console.WriteLine("IP: " + config.Value.VersionStr); sel_addr = config.Key; sel_config = config.Value; } Console.WriteLine("Done searching"); var cacher = new Cacher(); cacher.Changed += HandleCacher; cacher.Connect(sel_config, sel_addr); while (true) { cacher.Check(); } }
public Form1() { InitializeComponent(); cacher.Changed += cacher_Changed; // thread to keep checking bg = new Thread(() => { while (alive) { cacher.Check(); } }); bg.Start(); }