public TSerialPortController(TSerialPortModel serialPortModel) { //this._Port.PortName = serialPortModel.PortName; //this._Port.BaudRate = serialPortModel.BaudRate; //this._Port.DataBits = serialPortModel.DataBit; //this._Port.StopBits = serialPortModel.StopBit; //this._Port.DataReceived += new SerialDataReceivedEventHandler(Sub_DataReceivedEventHandler); }
public static TSerialPortController Initalize(TSerialPortModel portModel) { if (!_FlyweightFactoryDictionary.ContainsKey(portModel.COMID)) { lock (_lock) { if (!_FlyweightFactoryDictionary.ContainsKey(portModel.COMID)) { TSerialPortController portController = new TSerialPortController(portModel); _FlyweightFactoryDictionary.Add(portModel.COMID, portController); } } } return(_FlyweightFactoryDictionary[portModel.COMID]); }