Accessing the serial port in a portable class library in C#
I'm writing a UWP App in which I'm accessing the serial port via Windows.Devices.SerialCommunication.SerialDevice
. Now I have to export my code into a portable class library. In the pcl I have no access to any framework which grand me access to the serial port of my computer.
I've found this article. It says that I have to implement an interface in my pcl and write the code for accessing the serial port for each specific platform in an extra library. But I'm not that advanced in coding and I don't really understand how to do so.
Because of that I'm asking if someone has experience with accessing the serial port in an portable class library and can provide an easy way to do so? Maybe with UWP comes an easier way to realize this.
You cannot use Windows.Devices.SerialCommunication.SerialDevice in the Portable library directly. Because it is a platform specific API provided by Windows Runtime.
In this case, you can use the data model class to wrap the data object.
For example:
链接地址: http://www.djcxy.com/p/68862.html上一篇: 如何分享课程
下一篇: 在C#中的可移植类库中访问串行端口