创建WP8试用应用
参考资料:
Windows Phone 7 开发 31 日谈——第23日:提供试用版应用程序
对资料总结下:
如何检查应用中的试用许可证:
在App.xaml.cs中添加下面两行
using Microsoft.Phone.Marketplace;
private static LicenseInformation _licenseInfo = new LicenseInformation();
使用_licenseInfo.IsTrial()方法,即读取LicenseInformation对象上的IsTrial属性,返回True时为试用版,否则为付费版
但是实际上在调试时,应用的真实许可信息只有在发布到商店后才能使用,所以再在App.xaml.cs里使用以下两段代码。使用后,在调试时将执行#if Debug与#else之间的代码,进行手动设置是否为试用版;在释放模式下时,将执行#else与#endif之间的代码,即读取LicenseInformation对象上的IsTrial属性来设置是否试用版。
private static bool _isTrial = true;
public bool IsTrial
{
get
{
return _isTrial;
}
}
/// <summary>
/// Check the current license information for this application
/// </summary>
private void CheckLicense()
{
// When debugging, we want to simulate a trial mode experience. The following conditional allows us to set the _isTrial
// property to simulate trial mode being on or off.
#if DEBUG
string message = "This sample demonstrates the implementation of a trial mode in an application." +
"Press 'OK' to simulate trial mode. Press 'Cancel' to run the application in normal mode.";
if (MessageBox.Show(message, "Debug Trial",
MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
_isTrial = true;
}
else
{
_isTrial = false;
}
#else
_isTrial = _licenseInfo.IsTrial();
#endif
}
在应用开始或恢复时都需要检查应用的许可证:
即在App.xaml.cs中的Application_Launching和Application_Activated事件中添加试用版的判断方法CheckLicense()
使用当前应用的许可证信息:
由于在App.xaml.cs里设置了IsTrial属性来读取许可证属性,因此我们可以通过使用(Application.Current as App).IsTrial属性来直接获取应用的许可证信息,避免重复使用IsTrial()方法,该方法一次典型调用耗时60毫秒或更多。
创建WP8试用应用的更多相关文章
- 学习 WebService 第五步:在Local创建测试用WebService(WSDL)
[准备] Eclipse+Tomcat7(Tomcat端口修改为不冲突的值) axis2 1.7.7 jar包(没有来这里下载:http://www.apache.org/dyn/closer.lua ...
- ASP.NET Core 中文文档 第二章 指南(1)用 Visual Studio Code 在 macOS 上创建首个 ASP.NET Core 应用程序
原文:Your First ASP.NET Core Application on a Mac Using Visual Studio Code 作者:Daniel Roth.Steve Smith ...
- WP7/WP8/WP8.1设置存储的区别
最近做的一个软件,由于最初是针对WP7的,现在在只能创建WP8.1的visual studio 2013上转换为了WP8的. 由于要保存字体大小.背景颜色.JSON三个数据,一直使用的是WP7下的存储 ...
- Cordova WP8 平台安装部署
原文:Cordova WP8 平台安装部署 Cordova是一个开放源码移动开发框架. 它允许您使用标准的 web 技术如 HTML5. CSS3 和 JavaScript 进行跨平台开发,避免每个移 ...
- 使用 Azure CLI 创建 Windows 虚拟机
Azure CLI 用于从命令行或脚本创建和管理 Azure 资源. 本指南详细介绍如何使用 Azure CLI 部署运行 Windows Server 2016 的虚拟机. 部署完成后,我们连接到服 ...
- 使用 Azure 门户创建 Windows 虚拟机
可以通过 Azure 门户创建 Azure 虚拟机. 此方法提供一个基于浏览器的用户界面,用于创建和配置虚拟机和所有相关的资源. 本快速入门介绍了如何创建虚拟机并在 VM 上安装 webserver. ...
- 使用 PowerShell 创建 Linux 虚拟机
Azure PowerShell 模块用于从 PowerShell 命令行或脚本创建和管理 Azure 资源. 本指南详细介绍了如何使用 Azure PowerShell 模块部署运行 Ubuntu ...
- 使用 Azure 门户创建 Linux 虚拟机
可以通过 Azure 门户创建 Azure 虚拟机. 此方法提供一个基于浏览器的用户界面,用于创建和配置虚拟机和所有相关的资源. 本快速入门介绍了如何创建虚拟机并在 VM 上安装 webserver. ...
- 使用 Azure CLI 创建 Linux 虚拟机
Azure CLI 用于从命令行或脚本创建和管理 Azure 资源. 本指南详细介绍了如何使用 Azure CLI 部署运行 Ubuntu 服务器的虚拟机. 服务器部署以后,将创建 SSH 连接,并且 ...
随机推荐
- 购物车相关 js
<div class="caigou"> <form action="" method="post"> <di ...
- [ActiveMQ]初识ActiveMQ
初识ActiveMQ ActiveMQ介绍 官方网站:http://activemq.apache.org/ 最新版本:ActiveMQ 5.14.1(2016-10-28) 最新版本下载链接:htt ...
- 转DNS DLZ +MYSQL
关于bind的软件介绍这里就不讲解了 大家都知道是干嘛的 这里多介绍一下DLZ这个东西 大家都知道维护bind的时候 如果想新增一个zone 需要vim 编辑添加 这样.....然后bind启动后从 ...
- Windows下C编程获取软件安装列表信息
代码如下: #include <windows.h> #include <stdio.h> #include <iostream> #include <vec ...
- ListView只更新某个item
方案1:针对需要更新的item调用public View getView(int position, View convertView, ViewGroup parent)即可.如: public c ...
- Oracle 在线重定义表分区
==================原始表================原始表=====================原始表 create table BUILDING_temp(building ...
- maven打包
1.利用maven-jar-plugin <build> <plugins> <!-- The configuration of maven-jar-plugin --& ...
- 【笔记】ztree的使用
引用的js和css: <!-- zTreeJS --><script type="text/javascript" src="jquery/jquery ...
- Mysql Master-slave 主从配置
MySQL主从复制 场景描述:主数据库服务器:192.168.10.130,MySQL已经安装,并且无应用数据.从数据库服务器:192.168.10.131,MySQL已经安装,并且无应用数据. 2. ...
- pycharm配置字体问题
A scheme with this name already exists or was deleted without applying the changes 解决办法:$cd ~/.PyCha ...