using System; using System.Collections.Generic; using System.Text; using DBFactory; namespace CommonLib { using System; using System.Data; using System.ComponentModel; /// /// 20110405自定义数据视图变化事件 /// public class CDataChangeEventArgs : EventArgs { #region 数据更新事件 private readonly DataView _manDataSource; public DataView ManDataSource { get { return _manDataSource; } } private readonly DataView _monDataSource; public DataView MonDataSource { get { return _monDataSource; } } public CDataChangeEventArgs(DataView manDataSource,DataView monDataSource) { this._manDataSource = manDataSource; this._monDataSource = monDataSource; } #endregion } public class CDeviceStateChangeEventArgs : EventArgs { #region 设备状态数据更新事件 Model.MDevice _devinfo; public Model.MDevice Devinfo { get { return _devinfo; } set { _devinfo = value; } } public CDeviceStateChangeEventArgs(Model.MDevice devinfo) { this._devinfo = devinfo; } #endregion } /// /// 20110608自定义更新数据库的变化事件(执行SQL,报告完成) /// public class CUpdateDBChangeEventArgs : EventArgs { #region 数据库更新事件(执行SQL,报告完成) private readonly int _taskindex=-1; public int Taskindex { get { return _taskindex; } } private readonly int _deviceindex = -1; public int Deviceindex { get { return _deviceindex; } } private readonly int _taskstate = -1; /// /// 任务执行状态:0空闲,1运行,2动作完成 ,大于30故障 /// public int Taskstate { get { return _taskstate; } } /// /// 光电开关被拆分的字节值 /// private readonly byte[] _splitbyteValue ; /// /// 命令 /// public byte[] SplitbyteValue { get { return _splitbyteValue; } } private readonly DBFactory.DBOperator _dbo; public DBFactory.DBOperator Dbo { get { return _dbo; } } private readonly StringBuilder _exeSQL = new StringBuilder(); private readonly byte[] _devicestates; public byte[] Devicestates { get { return _devicestates; } } public StringBuilder ExeSQL { get { return _exeSQL; } } public CUpdateDBChangeEventArgs(DBFactory.DBOperator dbo, StringBuilder exeSQL) { _dbo = dbo; _exeSQL = exeSQL; } /// /// /// /// 设备索引 /// 设备指令索引 /// 任务执行状态:0空闲,1运行,2动作完成 ,大于30故障 public CUpdateDBChangeEventArgs(int deviceindex, int taskindex, int taskstate) { _deviceindex = deviceindex; _taskindex = taskindex; _taskstate = taskindex; } /// /// /// /// 设备索引 /// 设备指令索引 /// 任务执行状态:0空闲,1运行,2动作完成 ,大于30故障 /// X坐标 /// Y坐标 public CUpdateDBChangeEventArgs(int deviceindex,byte[] splitbyteValue,byte[] devicestates) { _deviceindex = deviceindex; _splitbyteValue = splitbyteValue; _devicestates = devicestates; } #endregion } public class CStringInfoEventArgs : EventArgs { private int _deviceindex; public int Deviceindex { get { return _deviceindex; } set { _deviceindex = value; } } private string _barcode; public string Barcode { get { return _barcode; } set { _barcode = value; } } private int _confirm; public int Confirm { get { return _confirm; } set { _confirm = value; } } public CStringInfoEventArgs(int deviceindex, string barcode, int confirm) { _deviceindex = deviceindex; _barcode = barcode; _confirm = confirm; } } public class CWriteDarkCasketEventArgs : EventArgs {//20121108 private string _wrnamespace; public string Wrnamespace { get { return _wrnamespace; } set { _wrnamespace = value; } } private string _wrmethod; public string Wrmethod { get { return _wrmethod; } set { _wrmethod = value; } } private string _wrkeyRemark; public string WrkeyRemark { get { return _wrkeyRemark; } set { _wrkeyRemark = value; } } private string _wrdevice; public string Wrdevice { get { return _wrdevice; } set { _wrdevice = value; } } private int[] _wrinfo; public int[] Wrinfo { get { return _wrinfo; } set { _wrinfo = value; } } public CWriteDarkCasketEventArgs(string wrnamespace, string wrmethod,string wrdevice, string wrkeyRemark, int[] wrinfo) { _wrnamespace = wrnamespace; _wrmethod = wrmethod; _wrdevice = wrdevice; _wrkeyRemark = wrkeyRemark; _wrinfo = wrinfo; } public CWriteDarkCasketEventArgs(string wrnamespace, string wrmethod, string wrdevice, string wrkeyRemark, byte[] wrinfo) { _wrnamespace = wrnamespace; _wrmethod = wrmethod; _wrdevice = wrdevice; _wrkeyRemark = wrkeyRemark; _wrinfo = new int[wrinfo.Length]; Array.Copy(wrinfo, _wrinfo, wrinfo.Length); } } public class CSendDeviceOrderEventArgs : EventArgs {//20121108 private int _deviceindex; public int Deviceindex { get { return _deviceindex; } set { _deviceindex = value; } } private string _remoteIP; public string RemoteIP { get { return _remoteIP; } set { _remoteIP = value; } } private int _remotePort; public int RemotePort { get { return _remotePort; } set { _remotePort = value; } } private byte[] _sendrinfo; public byte[] Sendrinfo { get { return _sendrinfo; } set { _sendrinfo = value; } } public CSendDeviceOrderEventArgs(int deviceindex, string remoteIP, int remotePort, byte[] sendrinfo) { _deviceindex = deviceindex; _remoteIP = remoteIP; _remotePort = remotePort; _sendrinfo = sendrinfo; } } public delegate void CWriteDarkCasketEventHandler(object sender, CWriteDarkCasketEventArgs e);//20121108 public delegate void CSendDeviceOrderEventHandler(object sender, CSendDeviceOrderEventArgs e);//20121108 public delegate void CDataSourceChangeEventHandler(object sender, CDataChangeEventArgs e); public delegate void CUpdateDBEventHandler(object sender, CUpdateDBChangeEventArgs e); public delegate void CDeviceStateChangeEventHandler(object sender,CDeviceStateChangeEventArgs e); public delegate void CStringInfoEventHandler(object sender,CStringInfoEventArgs e); }