windows-store-apps - 如何检查有效许可证(Microsoft Desktop Bridge)
问题描述
我想检查用户是否拥有 Windows 应用商店应用程序(桌面桥)的有效许可证。起初StoreLicense.IsActive
[1] 属性看起来很有希望,但文档状态:
此属性保留供将来使用,并且不打算在当前版本中使用。目前,它总是返回 true。
有趣的是,Microsoft [2] 提供的演示代码也使用了这个函数,尽管我可以确认它总是返回 true。
检查有效许可证的正确方法是什么?
问候,
[1] https://docs.microsoft.com/de-ch/uwp/api/windows.services.store.storelicense.isactive
[2] https://docs.microsoft.com/en-us/windows/uwp/monetize/implement-a-trial-version-of-your-app
解决方案
It seems like you want to check whether the user currently has a valid license to use the app, in this case, according to this section of the document Get license info for apps and add-ons:
To get license info for the current app, use the GetAppLicenseAsync method. This is an asynchronous method that returns a StoreAppLicense object that provides license info for the app, including properties that indicate whether the user currently has a valid license to use the app (IsActive) and whether the license is for a trial version (IsTrial).
So that from this document you could use StoreAppLicense.IsActive
property to check for valid App licence, not StoreLicense.IsActive
currently.
More details you could also reference the official sample.
推荐阅读
- rest - 1 个服务端点与 3 个用于在 CRUD 中创建/更新/删除的单独端点 | 建筑学
- tomcat - Spring-Boot 禁用响应头的传输编码
- c++ - 如何在 STL 容器中存储具有抽象模板类型的抽象模板类?
- c - 如果在循环中,指针是否会自行移动到数组中的下一行?
- swift - 如何在进入后台或恢复到前台时重定向到主屏幕
- codenameone - 代号:创建 PDF 文件
- python - 如何让 cv2 在 python3.6 上运行?
- php - 如何设置自定义路径来浏览和查看它的内容?
- r - imputation 数据框列表:使用调查包或 R 中的 MIcombine 计算分位数?
- c - 数组 c 上的分段错误