PointOfService device 功能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.unauthorizedaccessexception錯誤。You 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. 按一下功能清單中核取方塊旁的 [Point of Service] ,以啟用服務點裝置功能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>