添加一条记录的方法如下,这里提一下 wallet 也是独立应用的 使用Wallet的时候 找卡仅限于当前应用是不允许找其他应用的卡片信息的 原因大家都懂的,当然也可以使用 WalletAgent 进行实时更新。
Random RandomPayment = new Random(); async private void btnCreatePaymentTrans_Tap(object sender, System.Windows.Input.GestureEventArgs e) { // Find the payment instrument to use PaymentInstrument PI; PI = Wallet.FindItem("Contoso Credit Account") as PaymentInstrument; if (PI == null) { MessageBox.Show("Payment Card [Credit Account] not found on the wallet."); return; } // Create the transaction WalletTransaction transaction = new WalletTransaction(); transaction.DisplayAmount = RandomPayment.Next(50, 500).ToString(); transaction.Description = "Random online payment"; transaction.TransactionDate = DateTime.Now; // Add the transaction to the wallet PI.TransactionHistory.Add("Internet payment " + DateTime.Now, transaction); await PI.SaveAsync(); MessageBox.Show("Succesfully made a random payment. Check your wallet to see the transactions."); }