private static void timer1_Tick(object sender, System.Timers.ElapsedEventArgs e) { Listener obj = new Listener(); obj.callService(); //obj.Dispose(); //Console.WriteLine("processing completed"); }
static void Main(string[] args) { try { InitializeLogger(); Listener obj = new Listener(); obj.callService(); Console.WriteLine("processing completed"); timer1.Interval = 3000;//one second timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Tick); timer1.Start(); Console.Read(); obj.Dispose(); } catch(Exception ex) { Console.WriteLine(ex.Message.ToString()); logger.Error(ex.Message.ToString()); } }