What modern (PCL) equivalent for Handshake.XOnXOff?

旧城冷巷雨未停 提交于 2019-12-25 03:10:31

问题


I was using this legacy code:

SerialPort serialPort = new SerialPort();
serialPort.BaudRate = 19200;
serialPort.Handshake = Handshake.XOnXOff;

...but trying to port it to VS 2013 / .NET 4.5.1 in the "Core" (Portable Class Library) portion of a Xamarin solution, I get, "The name 'Handshake' does not exist in the current context"

According to this, the Handshake enum is in System.IO.Ports namespace, but adding that to my usings evokes "The type or namespace name 'Ports' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)"

Perhaps I am missing an assembly reference? The link above says it's in System. My only reference is ".NET Portable Subset" which I assume (I know, I know, when you ASSume you Aynchronously Syncopate Sinkholes or something like that) would have System embedded in it.

When I r-click References and select Add Reference..., the options proffered are somewhat slight:

So...how can I use Handshake.XOnXOff? If I can't, what are my viable options?


回答1:


I don't think you're going to be able to implement print functionality in a platform agnostic way. Your best bet would be to define some sort of IPrinting interface. That interface can be implemented in a platform specific library, then a reference can be passes into your PCL, so that the PCL can hand off the printing duties via the Interface.



来源:https://stackoverflow.com/questions/22570498/what-modern-pcl-equivalent-for-handshake-xonxoff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!