PointOfService 设备功能PointOfService device capability

你可以通过声明应用程序包清单中的功能请求访问 PointOfService API] 你可以使用 Microsoft Visual Studio 中的清单设计器声明大多数功能,也可以手动添加。You request access to the PointOfService APIs by declaring the capability in your application package manifest] You can declare most capabilities by using the Manifest Designer, in Microsoft Visual Studio, or you can add them manually.

重要

如果未在应用程序清单中声明PointOfService功能,则在尝试使用 PointOfService 命名空间中的 API 时,你将收到错误system.unauthorizedaccessexceptionYou will receive the error System.UnauthorizedAccessException when you attempt to use an API in the Windows.Devices.PointOfService namespace if you do not declare the pointOfService capability in your application manifest.

使用清单设计器声明功能Declare capability using Manifest Designer

  1. 解决方案资源管理器中,展开你的 UWP 应用程序的项目节点。In Solution Explorer, expand the project node of your UWP application.
  2. 双击 Package.appxmanifest 文件。Double-click the Package.appxmanifest file.
    如果清单文件已在 XML 代码视图中打开,则 Visual Studio 会提示你关闭此文件。If the manifest file is already open in the XML code view, Visual Studio prompts you to close the file.
  3. 单击功能选项卡Click the Capabilities tab
  4. 单击功能列表中服务点旁边的复选框以启用服务点设备功能Click the checkbox next to Point of Service in the list of capabilities to enable the Point of Service device capability

手动声明功能Declare capability manually

  1. 解决方案资源管理器中,展开你的 UWP 应用程序的项目节点。In Solution Explorer, expand the project node of your UWP application.
  2. 右键单击 Package.appxmanifest 文件并选择查看代码Right-click the Package.appxmanifest file and choose View Code
  3. 将 PointOfService DeviceCapability 元素添加到你的应用程序清单的“功能”部分。Add the PointOfService DeviceCapability element to Capabilities section of your application manifest.
  <Capabilities>
    <DeviceCapability Name="pointOfService" />
  </Capabilities>