/// <summary>
        /// Adds a new membership card wallet item to Wallet.
        /// </summary>
        /// <returns></returns>
        private async Task AddItemAsync()
        {
            try
            {
                // Create the membership card.
                WalletItem card = new WalletItem(WalletItemKind.MembershipCard, "Contoso Loyalty Card");

                // Set colors, to give the card our distinct branding.
                card.BodyColor       = Windows.UI.Colors.Brown;
                card.BodyFontColor   = Windows.UI.Colors.White;
                card.HeaderColor     = Windows.UI.Colors.SaddleBrown;
                card.HeaderFontColor = Windows.UI.Colors.White;

                // Set basic properties.
                card.IssuerDisplayName = "Contoso Coffee";

                // Set some images.
                card.Logo336x336 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/coffee336x336.png"));

                card.Logo99x99 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/coffee99x99.png"));

                card.Logo159x159 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/coffee159x159.png"));

                card.HeaderBackgroundImage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/header640x130.png"));

                // Set the loyalty card points and show them on the detailed view of card and in the list view.
                WalletItemCustomProperty prop = new WalletItemCustomProperty("Coffee Points", "99");
                prop.DetailViewPosition            = WalletDetailViewPosition.FooterField1;
                prop.SummaryViewPosition           = WalletSummaryViewPosition.Field1;
                card.DisplayProperties["PointsId"] = prop;

                // Show the branch.
                prop = new WalletItemCustomProperty("Branch", "Contoso on 5th");
                prop.DetailViewPosition            = WalletDetailViewPosition.HeaderField1;
                card.DisplayProperties["BranchId"] = prop;

                // Add the customer account number.
                prop = new WalletItemCustomProperty("Account Number", "12345678");
                prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;

                // We don't want this field entity extracted as it will be interpreted as a phone number.
                prop.AutoDetectLinks             = false;
                card.DisplayProperties["AcctId"] = prop;

                // Encode the user's account number as a Qr Code to be used in the store.
                card.Barcode = new WalletBarcode(WalletBarcodeSymbology.Qr, "12345678");

                // Add a promotional message to the card.
                card.DisplayMessage             = "Tap here for your 15% off coupon";
                card.IsDisplayMessageLaunchable = true;

                await wallet.AddAsync("CoffeeLoyalty123", card);

                rootPage.NotifyUser("Item has been added to Wallet. Tap \"View item in Wallet\" to see it in Wallet.", NotifyType.StatusMessage);
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(ex.Message, NotifyType.ErrorMessage);
            }
        }
Beispiel #2
0
        /// <summary>
        /// create Wallet
        /// </summary>
        public async void CreateWallet()
        {
            try
            {
                // Create the membership card.
                WalletItem card = new WalletItem(WalletItemKind.MembershipCard, "My Card");
                // Set colors, to give the card our distinct branding.
                card.BodyColor       = Windows.UI.Colors.Brown;
                card.BodyFontColor   = Windows.UI.Colors.White;
                card.HeaderColor     = Windows.UI.Colors.SaddleBrown;
                card.HeaderFontColor = Windows.UI.Colors.White;
                // Set basic properties.
                card.IssuerDisplayName = "Bank";
                // Set some images.
                card.Logo336x336 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/wallet/coffee336x336.png"));

                card.Logo99x99 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/wallet/coffee99x99.png"));

                card.Logo159x159 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/wallet/coffee159x159.png"));

                card.HeaderBackgroundImage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/wallet/header640x130.png"));

                // Set the loyalty card points and show them on the detailed view of card and in the list view.
                WalletItemCustomProperty prop = new WalletItemCustomProperty("Money", "1000000");
                prop.DetailViewPosition              = WalletDetailViewPosition.FooterField1;
                prop.SummaryViewPosition             = WalletSummaryViewPosition.Field1;
                card.DisplayProperties[conCardMoney] = prop;
                // Show the branch.
                prop = new WalletItemCustomProperty("Branch", "Bank on 5th");
                prop.DetailViewPosition            = WalletDetailViewPosition.HeaderField1;
                card.DisplayProperties["BranchId"] = prop;
                // Add the customer account number.
                prop = new WalletItemCustomProperty("Account Number", "2014************3697");
                prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;
                // We don't want this field entity extracted as it will be interpreted as a phone number.
                prop.AutoDetectLinks             = false;
                card.DisplayProperties["AcctId"] = prop;
                // Encode the user's account number as a Qr Code to be used in the store.
                card.Barcode = new WalletBarcode(WalletBarcodeSymbology.Qr, "20141212025641693697");
                // Add a promotional message to the card.
                card.DisplayMessage             = "Tap here for the fast payment";
                card.IsDisplayMessageLaunchable = true;
                await wallet.AddAsync(conCardID, card);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Beispiel #3
0
        pkPassConversionResult parsePkpassType(IReadOnlyList<Windows.Storage.StorageFile> files)
        {
            try
            {
                WalletItem item = null;
                CurrentInfo = "Opening pass.json...";
                JObject o = getJsonData(files.Where(x => x.Name == "pass.json").First());
                //Determine the type of the card and return it.
                if (o["boardingPass"] != null)
                {
                    pkPassType = "boardingPass";
                    item = new WalletItem(WalletItemKind.BoardingPass, o["description"].Value<string>());
                }
                else if (o["coupon"] != null)
                {
                    pkPassType = "coupon";
                    item = new WalletItem(WalletItemKind.Deal, o["description"].Value<string>());
                }
                else if (o["eventTicket"] != null)
                {
                    pkPassType = "eventTicket";
                    item = new WalletItem(WalletItemKind.Ticket, o["description"].Value<string>());
                }
                else if (o["storeCard"] != null)
                {
                    pkPassType = "storeCard";
                    item = new WalletItem(WalletItemKind.MembershipCard, o["description"].Value<string>());
                }
                else if (o["generic"] != null)
                {
                    pkPassType = "generic";
                    item = new WalletItem(WalletItemKind.General, o["description"].Value<string>());
                }
                else throw new Exception();

                //Get images
                CurrentInfo = "Fetching images...";
                item.Logo99x99 = item.Logo159x159 = item.Logo336x336 = getImageFromName("icon.png", contents);
                item.HeaderBackgroundImage = getImageFromName("logo.png", contents);
                item.BodyBackgroundImage = getImageFromName("background.png", contents);

                CurrentInfo = "Fetching colors...";
                item.BodyColor = HelperMethods.getColorFromRGBString(o["backgroundColor"].Value<string>());
                item.BodyFontColor = HelperMethods.getColorFromRGBString(o["foregroundColor"].Value<string>());
                item.HeaderColor = item.BodyColor;
                item.HeaderFontColor = HelperMethods.getColorFromRGBString(o["labelColor"].Value<string>());

                int i = 0;
                if (o[pkPassType]["primaryFields"] != null)
                {
                    foreach (JObject jo in o[pkPassType]["primaryFields"])
                    {
                        WalletItemCustomProperty prop = new WalletItemCustomProperty(jo["label"].Value<string>(), jo["value"].Value<string>());
                        if (i == 0) prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField1;
                        else if (i == 1) prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField2;
                        else throw new InvalidDataException();
                        item.DisplayProperties[jo["key"].Value<string>()] = prop;
                        i++;
                    }
                }

                //Secondary fields
                i = 0;
                if (o[pkPassType]["secondaryFields"] != null)
                {
                    foreach (JObject jo in o[pkPassType]["secondaryFields"])
                    {
                        WalletItemCustomProperty prop = new WalletItemCustomProperty(jo["label"].Value<string>(), jo["value"].Value<string>());
                        if (i == 0) prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField1;
                        else if (i == 1) prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField2;
                        else if (i == 2) prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField3;
                        else if (i == 3) prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField4;
                        else if (i == 4) prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField5;
                        else throw new InvalidDataException();
                        item.DisplayProperties[jo["key"].Value<string>()] = prop;
                        i++;
                    }
                }

                //Auxiliary fields
                i = 0;
                if (o[pkPassType]["auxiliaryFields"] != null)
                {
                    foreach (JObject jo in o[pkPassType]["auxiliaryFields"])
                    {
                        WalletItemCustomProperty prop = new WalletItemCustomProperty(jo["label"].Value<string>(), jo["value"].Value<string>());
                        if (i == 0) prop.DetailViewPosition = WalletDetailViewPosition.FooterField1;
                        else if (i == 1) prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;
                        else if (i == 2) prop.DetailViewPosition = WalletDetailViewPosition.FooterField3;
                        else if (i == 3) prop.DetailViewPosition = WalletDetailViewPosition.FooterField4;
                        else throw new InvalidDataException();
                        item.DisplayProperties[jo["key"].Value<string>()] = prop;
                        i++;
                    }
                }

                //Header fields
                i = 0;
                if (o[pkPassType]["headerFields"] != null)
                {
                    foreach (JObject jo in o[pkPassType]["headerFields"])
                    {
                        WalletItemCustomProperty prop = new WalletItemCustomProperty(jo["label"].Value<string>(), jo["value"].Value<string>());
                        if (i == 0) prop.DetailViewPosition = WalletDetailViewPosition.HeaderField1;
                        else if (i == 1) prop.DetailViewPosition = WalletDetailViewPosition.HeaderField2;
                        else throw new InvalidDataException();
                        item.DisplayProperties[jo["key"].Value<string>()] = prop;
                        i++;
                    }
                }

                //Header fields
                if (o[pkPassType]["backFields"] != null)
                {
                    foreach (JObject jo in o[pkPassType]["backFields"])
                    {
                        WalletItemCustomProperty prop = new WalletItemCustomProperty(jo["label"].Value<string>(), jo["value"].Value<string>());
                        prop.SummaryViewPosition = WalletSummaryViewPosition.Hidden;
                        item.DisplayProperties[jo["key"].Value<string>()] = prop;
                    }
                }

                if (o["barcode"] != null)
                {
                    WalletBarcodeSymbology sym = new WalletBarcodeSymbology();
                    switch (o["barcode"]["format"].Value<string>())
                    {
                        case "PKBarcodeFormatQR": sym = WalletBarcodeSymbology.Qr; break;
                        case "PKBarcodeFormatPDF417": sym = WalletBarcodeSymbology.Pdf417; break;
                        case "PKBarcodeFormatAztec": sym = WalletBarcodeSymbology.Aztec; break;
                        default: throw new InvalidDataException();
                    }
                    item.Barcode = new WalletBarcode(sym, o["barcode"]["message"].Value<string>());
                }

                if (o["locations"] != null)
                {
                    i = 0;
                    foreach (JObject jo in o["locations"])
                    {
                        WalletRelevantLocation location = new WalletRelevantLocation();
                        if (jo["relevantText"] != null)
                        {
                            location.DisplayMessage = jo["relevantText"].Value<string>();
                        }
                        var position = new Windows.Devices.Geolocation.BasicGeoposition();
                        position.Latitude = jo["latitude"].Value<double>();
                        position.Longitude = jo["longitude"].Value<double>();
                        try
                        {
                            position.Altitude = jo["altitude"].Value<double>();
                        }
                        catch (Exception)
                        {
                            System.Diagnostics.Debug.WriteLine("An altitude does not exist for location " + location.DisplayMessage);
                        }
                        location.Position = position;
                        //Check one doesn't already exist.
                        if (item.RelevantLocations.Where(x => x.Key == i.ToString()).Count() > 0)
                            i++;
                        else
                            item.RelevantLocations.Add(i.ToString(), location);
                        i++;
                    }
                }

                if (o["relevantDate"] != null)
                {
                    item.RelevantDate = DateTime.Parse(o["relevantDate"].Value<string>());
                }

                if (o["expirationDate"] != null)
                {
                    item.ExpirationDate = DateTime.Parse(o["expirationDate"].Value<string>());
                }

                string cardId = o["serialNumber"].Value<string>();

                pkPassConversionResult result = new pkPassConversionResult();
                result.item = item; result.cardId = cardId;
                return result;
            }
            catch (Exception ex)
            {
                CurrentInfo = "Exception: " + ex.Message;
                return null;
            }
        }
        /// <summary>
        /// Adds a new membership card wallet item to Wallet.
        /// </summary>
        /// <returns></returns>
        private async Task AddItemAsync()
        {
            try
            {
                // Create the membership card.
                WalletItem card = new WalletItem(WalletItemKind.MembershipCard, "Contoso Loyalty Card");

                // Set colors, to give the card our distinct branding.
                card.BodyColor = Windows.UI.Colors.Brown;
                card.BodyFontColor = Windows.UI.Colors.White;
                card.HeaderColor = Windows.UI.Colors.SaddleBrown;
                card.HeaderFontColor = Windows.UI.Colors.White;

                // Set basic properties.
                card.IssuerDisplayName = "Contoso Coffee";

                // Set some images.
                card.Logo336x336 =  await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/coffee336x336.png"));

                card.Logo99x99 =    await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/coffee99x99.png"));

                card.Logo159x159 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/coffee159x159.png"));

                card.HeaderBackgroundImage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///assets/header640x130.png"));

                // Set the loyalty card points and show them on the detailed view of card and in the list view.
                WalletItemCustomProperty prop = new WalletItemCustomProperty("Coffee Points", "99");
                prop.DetailViewPosition = WalletDetailViewPosition.FooterField1;
                prop.SummaryViewPosition = WalletSummaryViewPosition.Field1;
                card.DisplayProperties["PointsId"] = prop;

                // Show the branch.
                prop = new WalletItemCustomProperty("Branch", "Contoso on 5th");
                prop.DetailViewPosition = WalletDetailViewPosition.HeaderField1;
                card.DisplayProperties["BranchId"] = prop;

                // Add the customer account number.
                prop = new WalletItemCustomProperty("Account Number", "12345678");
                prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;

                // We don't want this field entity extracted as it will be interpreted as a phone number.
                prop.AutoDetectLinks = false;
                card.DisplayProperties["AcctId"] = prop;

                // Encode the user's account number as a Qr Code to be used in the store.
                card.Barcode = new WalletBarcode(WalletBarcodeSymbology.Qr, "12345678");

                // Add a promotional message to the card.
                card.DisplayMessage = "Tap here for your 15% off coupon";
                card.IsDisplayMessageLaunchable = true;

                await wallet.AddAsync("CoffeeLoyalty123", card);

                rootPage.NotifyUser("Item has been added to Wallet. Tap \"View item in Wallet\" to see it in Wallet.", NotifyType.StatusMessage);
            }
            catch (Exception ex)
            {
                rootPage.NotifyUser(ex.Message, NotifyType.ErrorMessage);
            }
        }
        private async void AddGeneralButtonQR_Click(object sender, RoutedEventArgs e)
        {
            WalletItemStore store = await WalletManager.RequestStoreAsync();

            //string itemId = string.IsNullOrEmpty(walletItemName.Text) ? walletItemName.Text : cardName;

            WalletItem card = new WalletItem(WalletItemKind.General, generalItemName);
            // Set colors, to give the card our distinct branding.
            card.BodyColor = Windows.UI.Colors.Brown;
            card.BodyFontColor = Windows.UI.Colors.White;
            card.HeaderColor = Windows.UI.Colors.SaddleBrown;
            card.HeaderFontColor = Windows.UI.Colors.White;


            card.Logo336x336 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/stellarMedium.png"));
            card.Logo159x159 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/stellarSmall.png"));
            card.Logo99x99 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/stellarIcon.png"));

            card.LogoImage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/stellarIcon.png"));
            card.LogoText = generalItemName;

            // Add the customer account number.
            WalletItemCustomProperty prop = new WalletItemCustomProperty("Litecoin", "Litecoin");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Title"] = prop;

            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Holder2"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("HOLD", "Hold");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Hold"] = prop;

            prop = new WalletItemCustomProperty("Website", "https://www.msn.com/");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField2;
            card.DisplayProperties["Website"] = prop;



            prop = new WalletItemCustomProperty("Balance", "0");
            prop.DetailViewPosition = WalletDetailViewPosition.FooterField1;
            prop.SummaryViewPosition = WalletSummaryViewPosition.Field1;
            card.DisplayProperties["Points"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("Account Number", "12345678");
            prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["AcctId"] = prop;

            // Encode the user's account number as a Qr Code to be used in the store.
            //card.Barcode = new WalletBarcode(WalletBarcodeSymbology.Qr, "12345678");

            // Add a promotional message to the card.
            card.DisplayMessage = "MSN!";
            card.IsDisplayMessageLaunchable = true;

            ((Button)sender).IsEnabled = false;
            this.GeneralInfoButtonQR.IsEnabled = true;

            await store.AddAsync(generalItemName, card);
        }
        private async void AddMembershipButtonQR_Click(object sender, RoutedEventArgs e)
        {
            WalletItemStore store = await WalletManager.RequestStoreAsync();

            //string itemId = string.IsNullOrEmpty(walletItemName.Text) ? walletItemName.Text : cardName;

            WalletItem card = new WalletItem(WalletItemKind.MembershipCard, membershipCardQRName);
            // Set colors, to give the card our distinct branding.
            card.BodyColor = Windows.UI.Colors.Brown;
            card.BodyFontColor = Windows.UI.Colors.White;
            card.HeaderColor = Windows.UI.Colors.SaddleBrown;
            card.HeaderFontColor = Windows.UI.Colors.White;


            card.Logo336x336 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CaffeLuzzoMedium.png"));
            card.Logo159x159 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CaffeLuzzoSmall.png"));
            card.Logo99x99 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CaffeLuzzoIcon.png"));

            card.LogoImage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CaffeLuzzoIcon.png"));
            card.LogoText = membershipCardQRName;

            // Add the customer account number.
            WalletItemCustomProperty prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Holder1"] = prop;

            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Holder2"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("Caffe Luzzo", "Membership Card");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Title"] = prop;

            prop = new WalletItemCustomProperty("Website", "http://www.caffelusso.com/#!");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField2;
            card.DisplayProperties["Website"] = prop;

            prop = new WalletItemCustomProperty("Address", "17725 Ne 65th St Ste A150, Redmond, WA 98052 ");
            prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField1;
            card.DisplayProperties["Address"] = prop;

            prop = new WalletItemCustomProperty("Rewards", "99");
            prop.DetailViewPosition = WalletDetailViewPosition.FooterField1;
            prop.SummaryViewPosition = WalletSummaryViewPosition.Field1;
            card.DisplayProperties["Points"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("Account Number", "12345678");
            prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["AcctId"] = prop;

            // Encode the user's account number as a Qr Code to be used in the store.
            card.Barcode = new WalletBarcode(WalletBarcodeSymbology.Qr, "12345678");

            // Add a promotional message to the card.
            card.DisplayMessage = "Tap here for your 15% off coupon";
            card.IsDisplayMessageLaunchable = true;
            
            card.Verbs.Add("visit", new WalletVerb("Visit Store"));

            ((Button)sender).IsEnabled = false;
            this.MembershipInfoButtonQR.IsEnabled = true;

            await store.AddAsync(membershipCardQRName, card);
        }
        private async void AddTicketButtonBarCode_Click(object sender, RoutedEventArgs e)
        {
            WalletItemStore store = await WalletManager.RequestStoreAsync();

            //string itemId = string.IsNullOrEmpty(walletItemName.Text) ? walletItemName.Text : cardName;

            WalletItem card = new WalletItem(WalletItemKind.Ticket, concertName);
            // Set colors, to give the card our distinct branding.
            card.BodyColor = Windows.UI.Colors.Brown;
            card.BodyFontColor = Windows.UI.Colors.White;
            card.HeaderColor = Windows.UI.Colors.SaddleBrown;
            card.HeaderFontColor = Windows.UI.Colors.White;

            card.Logo336x336 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/wlr_concert_Medium.png"));
            card.Logo159x159 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/wlr_concert_Small.png"));
            card.Logo99x99 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/wlr_concert_Icon.png"));

            card.LogoImage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/wlr_concert_Icon.png"));
            card.LogoText = concertName;

            // Add the customer account number.
            WalletItemCustomProperty prop = new WalletItemCustomProperty("Printed date", "2014-12-15");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField1;
            card.DisplayProperties["PrintedDate"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["Holder1"] = prop;


            prop = new WalletItemCustomProperty("Departing from", "Seattle-Tacoma (SEA)");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField1;
            card.DisplayProperties["Origin"] = prop;

            prop = new WalletItemCustomProperty("Destination", "New York (JFK)");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField2;
            prop.AutoDetectLinks = true;
            card.DisplayProperties["Destination"] = prop;

            prop = new WalletItemCustomProperty("Departure Time", "2014-12-19");
            prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField1;
            prop.AutoDetectLinks = true;
            card.DisplayProperties["Departure"] = prop;

            prop = new WalletItemCustomProperty("Arrival Time ", "2014-12-20");
            prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField2;
            prop.AutoDetectLinks = true;
            card.DisplayProperties["Arrival"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField3;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["Holder2"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField4;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["Holder3"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.CenterField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["Holder4"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("Name", "Joe Smith");
            prop.DetailViewPosition = WalletDetailViewPosition.FooterField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["Name"] = prop;

            prop = new WalletItemCustomProperty("Seat", "12B");
            prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["Seat"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("TicketNumber", "9876543210123");
            prop.DetailViewPosition = WalletDetailViewPosition.FooterField3;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["TicketNumber"] = prop;

            // Encode the user's account number as a Qr Code to be used in the store.
            card.Barcode = new WalletBarcode(WalletBarcodeSymbology.Ean13, "9876543210123");

            //card.ExpirationDate = new DateTimeOffset(new DateTime(2015, 1, 1), new TimeSpan(10, 0, 0, 0));

            card.IsAcknowledged = true;
            card.IssuerDisplayName = "WLR Concert";

            card.Verbs.Add("see", new WalletVerb("See"));

            // Add a relevant date.
            card.RelevantDate = DateTime.Now;
            card.RelevantDateDisplayMessage = "Once in a lifetime";

            // Add a promotional message to the card.
            card.DisplayMessage = "Concert ticket";
            card.IsDisplayMessageLaunchable = true;

            ((Button)sender).IsEnabled = false;
            this.TicketInfoButtonBarcode.IsEnabled = true;

            await store.AddAsync(concertName, card);
        }
        private async void AddExpiredDealPassButton_Click(object sender, RoutedEventArgs e)
        {
            WalletItemStore store = await WalletManager.RequestStoreAsync();

            //string itemId = string.IsNullOrEmpty(walletItemName.Text) ? walletItemName.Text : cardName;

            WalletItem card = new WalletItem(WalletItemKind.Deal, "Expired Deal");
            // Set colors, to give the card our distinct branding.
            card.BodyColor = Windows.UI.Colors.Brown;
            card.BodyFontColor = Windows.UI.Colors.White;
            card.HeaderColor = Windows.UI.Colors.SaddleBrown;
            card.HeaderFontColor = Windows.UI.Colors.White;


            card.Logo336x336 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CouponMedium.png"));
            card.Logo159x159 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CouponSmall.png"));
            card.Logo99x99 = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CouponIcon.png"));

            card.LogoImage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/icons/CouponIcon.png"));
            card.LogoText = dealName;

            // Add the customer account number.
            WalletItemCustomProperty prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Holder1"] = prop;

            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.HeaderField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Holder2"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("Sale", "Christmas Couple");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["SaleTitle"] = prop;

            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.PrimaryField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Holder3"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("Coupon Code", "987654321");
            prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField1;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            prop.AutoDetectLinks = false;
            card.DisplayProperties["Coupon Code"] = prop;

            prop = new WalletItemCustomProperty("HOLD", "HOLD");
            prop.DetailViewPosition = WalletDetailViewPosition.SecondaryField2;
            // We don't want this field entity extracted as it will be interpreted as a phone number.
            card.DisplayProperties["Holder4"] = prop;

            prop = new WalletItemCustomProperty("Valid Until", "2014-11-16");
            //prop.DetailViewPosition = WalletDetailViewPosition.FooterField1;
            prop.AutoDetectLinks = true;
            prop.SummaryViewPosition = WalletSummaryViewPosition.Field1;
            card.DisplayProperties["Website"] = prop;

            prop = new WalletItemCustomProperty("Website", "http://www.Contoso.com/");
            //prop.DetailViewPosition = WalletDetailViewPosition.FooterField2;
            prop.AutoDetectLinks = true;
            prop.SummaryViewPosition = WalletSummaryViewPosition.Field2;
            card.DisplayProperties["Website"] = prop;

            // Add the customer account number.
            prop = new WalletItemCustomProperty("Phone", "425-707-1234");
            //prop.DetailViewPosition = WalletDetailViewPosition.FooterField3;
            prop.AutoDetectLinks = true;
            card.DisplayProperties["phone"] = prop;

            prop = new WalletItemCustomProperty("Location", "1 Microsot Way, Redmond,  WA 98052");
            prop.AutoDetectLinks = true;
            //prop.DetailViewPosition = WalletDetailViewPosition.FooterField4;
            card.DisplayProperties["Address"] = prop;

            prop = new WalletItemCustomProperty("Email", "*****@*****.**");
            prop.AutoDetectLinks = true;
            card.DisplayProperties["Address"] = prop;

            // Encode the user's account number as a Qr Code to be used in the store.
            card.Barcode = new WalletBarcode(WalletBarcodeSymbology.Ean13, "9876543210123");

            //card.ExpirationDate = new DateTimeOffset(new DateTime(2015, 1, 1), new TimeSpan(10, 0, 0, 0));

            card.ExpirationDate = new DateTimeOffset(new DateTime(2014, 11, 16));
            //card.ExpirationDate = new DateTimeOffset(DateTime.UtcNow, new TimeSpan(0, 0, 0, 0));

            // NOTE: in the back of the card
            card.LastUpdated = new DateTimeOffset(new DateTime(2014, 10, 10));


            card.IsAcknowledged = true;
            card.IssuerDisplayName = "Contoso Ltd.";
            card.RelevantLocations.Add(
                "Store",
                new WalletRelevantLocation()
                {
                    DisplayMessage = "Store location",
                    Position = new Windows.Devices.Geolocation.BasicGeoposition()
                    {
                        Latitude = 47.640068,
                        Longitude = -122.129858
                    }
                });

            card.Verbs.Add("visit", new WalletVerb("Visit"));


            // Add a relevant date.
            card.RelevantDate = DateTime.Now;
            card.RelevantDateDisplayMessage = "Deal is available all the way in 2014!";

            // Add a promotional message to the card.
            card.DisplayMessage = "Tap here for your 15% off coupon";
            card.IsDisplayMessageLaunchable = true;

            ((Button)sender).IsEnabled = false;
            this.ExpiredDealPassInfoButton.IsEnabled = true;

            await store.AddAsync(expiredDealName, card);
        }