using Quartz; using Quartz.Impl; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.Threading.Tasks; using System.Timers; using System.IO; using TimeSchedule; using cuidian.Sql; namespace Service1 { public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { using (System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\启动时间.txt", true)) { sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "Start."); } Time_U8_to_Wang.GoU8_to_Wang(); //Time_U8_to_Wang.GoWang_to_U8(); //Time_U8_to_Wang.GoWang_to_U8Two(); //Time_U8_to_Wang.GoWang_to_U8Three(); Console.WriteLine("启动成功 "); } protected override void OnStop() { using (System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\启动时间.txt", true)) { sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "Stop."); } } private void aa() { using (System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\log.txt", true)) { sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "aa()."); } } private void bb() { string dtNow = DateTime.Now.ToString("HH"); if (DateTime.Now.ToString("HH") == "22") { Console.WriteLine(dtNow); } } } }