public void Initialization(EventHandler _ErrorEvent, EventHandler _DataReceivedEvent, ISerialProtocol _MyProtocol) { //在初始化之前,清除所有的Event added by harryMeng ClearErrorEvent(); ClearDataReceivedEvent(); this.ErrorEvent += _ErrorEvent; this.DataReceivedEvent += _DataReceivedEvent; this.MyProtocol = _MyProtocol; this.OpenPort(); }
public void Initialization(EventHandler _ErrorEvent, EventHandler _DataReceivedEvent, ISerialProtocol _MyProtocol) { //在初始化之前,清除所有的Event added by harryMeng Closing = false; Listening = false; buffer.Clear(); received_count = 0; send_count = 0; ClearErrorEvent(); ClearDataReceivedEvent(); _ErrorEventHandleList = new List <EventHandler>(); _DataReceivedEventHandleList = new List <EventHandler>(); this.ErrorEvent += _ErrorEvent; this.DataReceivedEvent += _DataReceivedEvent; this.MyProtocol = _MyProtocol; this.OpenPort(); }