using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace QMAPP.WinForm.FileSynchronizers { public abstract class FileSynchronizer:IFileSynchronizer { public QMAPP.FJC.Entity.Basic.MachineInfo Machine { get; protected set; } public FileSynchronizer(QMAPP.FJC.Entity.Basic.MachineInfo machine) { if (machine == null) { throw new ArgumentException("设备信息不能为Null", "machine"); } Machine = machine; } public virtual void Dispose() { } public void Start() { Start(false); } public virtual void Stop() { Console.WriteLine(string.Format("{3:HH:mm:ss}:{0}({1}) {2} Stoped", this.Machine.MACHINENAME, this.Machine.MACHINECODDE, this.GetType().Name, DateTime.Now)); } public virtual void Start(bool skiphistory) { Console.WriteLine(string.Format("{3:HH:mm:ss}:{0}({1}) {2} Started", this.Machine.MACHINENAME, this.Machine.MACHINECODDE, this.GetType().Name, DateTime.Now)); } public event EventHandler NewRecordFound; protected void OnNewRecordFound(InjParamEventArgs e) { if (NewRecordFound != null) { NewRecordFound.Invoke(this, e); } } public event EventHandler ExceptionCatched; protected void OnExceptionCatched(InjParamEventArgs e) { if (ExceptionCatched != null) { ExceptionCatched.Invoke(this, e); } } } }