private void OnChanged(object source, FileSystemEventArgs e) { string dir = @"C:\GiamSat\" + e.Name; if (e.FullPath == dir) { Console.WriteLine("File: " + e.FullPath + " " + e.ChangeType); SoGhiGiamSatThuMuc.WriteEntry("Da co thao tac Changed trong thu muc C:\\GiamSat"); } }
public void OnRenamed(object source, FileSystemEventArgs e) { string dir = @"C:\GiamSat\" + e.Name; if (e.FullPath == dir) { Console.WriteLine("File: {0} rename to {1}", dir, e.FullPath); SoGhiGiamSatThuMuc.WriteEntry("Da co thao tac Renamed trong thu muc C:\\GiamSat"); } }
protected override void OnStart(string[] args) { try { SoGhiGiamSatThuMuc.WriteEntry("Running"); Thread _t = new Thread(new ThreadStart(DoWork)); _t.IsBackground = true; _t.Start(); } catch (Exception ex) { SoGhiGiamSatThuMuc.WriteEntry(ex.Message); SoGhiGiamSatThuMuc.Close(); } Console.ReadLine(); }
protected override void OnStop() { SoGhiGiamSatThuMuc.WriteEntry("Stopped"); }