static void Main(string[] args) { try { server = new ServerObject(); listenThread = new Thread(new ThreadStart(server.Listen)); listenThread.Start(); } catch (Exception ex) { server.Disconnect(); Console.WriteLine(ex.Message); } }
static Thread listenThread; // thread for listener static void Main(string[] args) { //start the scheduler receiving from the external server and saving in local database of weather on schedule UpdateSheduler sheduler = new UpdateSheduler(minutesInterval: 1, cities: Setting.Cities); sheduler.Start(); try { server = new ServerObject(); //create listener listenThread = new Thread(new ThreadStart(server.Listen)); listenThread.Start(); } catch (Exception ex) { server.Disconnect(); Console.WriteLine(ex.Message); } }