日期:2014-05-17 浏览次数:20935 次
protected override void OnStart(string[] args)
{
FileStream fs = new FileStream(@"D:\Peroject\Test\Com.Ly.Solution1\_服务开始停止时间记录.txt", FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine("服务开始:" + DateTime.Now.ToString() + "\n");
m_streamWriter.Flush();
m_streamWriter.Close();
fs.Close();
System.Timers.Timer time = new System.Timers.Timer();
time.Interval = 3600000;
time.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Tick);
time.Enabled = true;
time.Start();
}
234567891011121314151617181920212223 protected override void OnStart(string[] args) { FileStream fs = new FileStream(@"D:\Peroject\Test\Com.Ly.Solution1\_服务开始停止时间记录.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter m_streamWriter = new StreamWriter(fs); m_streamWriter.BaseStream.Seek(0, SeekOrigin.End); m_streamWriter.WriteLine("服务开始:" + DateTime.Now.ToString() + "\n"); m_streamWriter.Flush(); m_streamWriter.Close(); fs.Close(); System.Timers.Timer time = new System.Timers.Timer(); time.Interval = 0; //先设为0 time.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Tick); time.Enabled = true