Windows Phone 8 钱包功能开发详解
1. 优惠券与未确认交易处理
在 Windows Phone 8 开发中,对于已使用的优惠券和未确认的交易有特定的处理方式。以下是处理已使用优惠券的代码:
foreach(Coupon usedCoupon in usedCoupons)
{
AllCoupons.Remove(usedCoupon);
Wallet.Remove(usedCoupon.Id);
}
上述代码会遍历已使用的优惠券列表,将其从 AllCoupons 集合中移除,并从钱包中移除对应的优惠券。
对于未确认的交易,可以通过以下代码获取:
var unacknowledgedDeals =
(await Wallet.GetItemsAsync()).Where(deal => deal.IsAcknowledged == false);
foreach (Deal unknownDeal in unacknowledgedDeals)
{
// handle the unknown deal
// eg. create a local coupon from it or delete it from the wallet
}
这里会从钱包中获取所有未确认的交易,开发者可以根据需求对这些未知交易进行处理,比如创建本地优惠券或从钱包中删除。
超级会员免费看
订阅专栏 解锁全文
1825

被折叠的 条评论
为什么被折叠?



