static void Main(string[] args) { _GetCallTarget gtc = new _GetCallTarget(); List <GetCallTarget> timeConfig = new List <GetCallTarget>(); gtc.GetCall(out timeConfig); foreach (GetCallTarget item in timeConfig) { DateTime time = Convert.ToDateTime(item.time); Console.WriteLine(time.Hour); Console.WriteLine(time.Minute); Console.WriteLine(time.Second); Console.WriteLine("下一个"); Console.ReadLine(); } }
private void StartService() { _GetCallTarget gtc = new _GetCallTarget(); try { gtc.GetCall(out timeConfig); } catch (Exception) { StopService(); MessageBox.Show("正确检查配置文件,并重新启动服务!"); } timer1.Interval = 5000; this.Text = "定时服务,运行中"; timer1.Start(); timer2.Interval = 10000; timer2.Start(); }