PointOfService 设备共享

本主题介绍了如何在多台计算机依赖于共享外围设备(而不是连接到每台计算机的专用外围设备)的环境中,与其他计算机共享连接了网络或蓝牙的外围设备。

重要的 API

设备共享

通过网络和蓝牙连接的 PointOfService 外围设备通常会在多个客户端设备全天共享相同外围设备的环境中使用。 在繁忙的零售或餐饮服务环境中,客户端设备连接到外围设备的任何延迟都会影响到工作效率,即关联伙伴关闭与顾客的交易并转到为下一位顾客服务的工作效率。 在快速服务餐厅方案中,使用收据打印机作为厨房打印机,将客户订单的详细信息传送到厨房进行备餐,此时有多个客户端设备从顾客那里获得订单。 当订单完成后,每个客户端设备应该都能够声明共享的打印机,并立即为厨房打印订单。

在这些环境中,应用程序必须完全释放设备对象,以便其他客户端设备可以声明同一设备,这一点非常重要。

在“using”块的末尾释放 PosPrinter

using Windows.Devices.PointOfService;
using(PosPrinter printer = await PosPrinter.FromIdAsync("Device ID"))
{
    if (printer != null)
    {
        // Exercise the printer.
    }

    // When leaving this scope, printer.Dispose() is automatically invoked, 
    // releasing the session we have with the printer.
}

通过显式调用 Dispose() 释放 PosPrinter

using Windows.Devices.PointOfService;

PosPrinter printer = await PosPrinter.FromIdAsync("Device ID");
if (printer != null)
{
    // Exercise the printer, then dispose of the printer explicitly.
    printer.Dispose();
}

支持和反馈

查找问题的答案

有问题? 请在文档问答论坛上使用 UWP 标记或在 Stack Overflow 上使用 pointofservice 标记向我们提问。

帮助我们找到你的问题:

  • 在 Stack Overflow 上,将 pointofservice 标记添加到你的问题中。
  • 在问答论坛上,将“UWP”一词添加到你的帖子中