예제 #1
0
 private void fileCreated(object sender, System.IO.FileSystemEventArgs e)
 {
     MyServiceLogger.Log(e.Name + " Dropped At :" + DateTime.Now.TimeOfDay.ToString());
     childThread = new Thread(() => MainLogic.testingAndMoving(e.FullPath));
     if (!MainLogic.isFileLocked(new FileInfo(e.FullPath)))
     {
         childThread.Start();
     }
     else
     {
         childThread.Suspend();
         System.Timers.Timer ticker = new System.Timers.Timer(900000);
         ticker.Elapsed += delegate { restartThread(childThread, ticker); };
         ticker.Enabled  = true;
         ticker.Start();
     }
 }
예제 #2
0
 protected override void OnStop()
 {
     fileSystemWatcher1.EnableRaisingEvents = false;
     MyServiceLogger.Log("Stopped Service At: " + DateTime.Now.TimeOfDay.ToString());
 }
예제 #3
0
 protected override void OnStart(string[] args)
 {
     fileSystemWatcher1.EnableRaisingEvents = true;
     MyServiceLogger.Log("Started Moving Service At: " + DateTime.Now.TimeOfDay.ToString());
 }