You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.7 KiB
73 lines
1.7 KiB
4 years ago
|
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<InjParamEventArgs> NewRecordFound;
|
||
|
|
||
|
protected void OnNewRecordFound(InjParamEventArgs e)
|
||
|
{
|
||
|
if (NewRecordFound != null)
|
||
|
{
|
||
|
NewRecordFound.Invoke(this, e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public event EventHandler<InjParamEventArgs> ExceptionCatched;
|
||
|
|
||
|
protected void OnExceptionCatched(InjParamEventArgs e)
|
||
|
{
|
||
|
if (ExceptionCatched != null)
|
||
|
{
|
||
|
ExceptionCatched.Invoke(this, e);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|