private static void OnTimer(object sender, ElapsedEventArgs e) { timer.Stop(); Debug.WriteLine("Connecting to Sim..."); if (sim.IsConnected) { timer.Stop(); Debug.WriteLine("Starting Web Service..."); server = new WebServer(ReceiveCallback, "http://+:" + port + "/"); server.Run(); return; } sim.Connect(); }