Handshake.XOnXOff相当于什么现代(PCL)? [英] What modern (PCL) equivalent for Handshake.XOnXOff?

查看:251
本文介绍了Handshake.XOnXOff相当于什么现代(PCL)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下旧代码:

I was using this legacy code:

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

...但是尝试在Xamarin解决方案的核心"(便携式类库)部分中将其移植到VS 2013/.NET 4.5.1时,我得到"名称握手"没有存在于当前上下文中"

...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"

根据 this ,握手枚举位于System.IO.Ports命名空间中,但是将其添加到我的使用中会引起"类型或名称空间名称'Ports'在该命名空间中不存在 'System.IO'(您是否缺少程序集引用?)"

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?)"

也许我 am 缺少程序集引用吗?上面的链接说它在系统中.我唯一的参考是我假定的".NET便携式子集"(我知道,当您假设您异步地对置Sinkholes之类的东西时)会嵌入系统.

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:

那么...我该如何使用Handshake.XOnXOff?如果我做不到,我有什么可行的选择?

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

推荐答案

我认为您不会以与平台无关的方式来实现打印功能.最好的选择是定义某种IPrinting接口.该接口可以在特定于平台的库中实现,然后可以将引用传递到您的PCL中,以便PCL可以通过该接口来执行打印任务.

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.

这篇关于Handshake.XOnXOff相当于什么现代(PCL)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆