예제 #1
0
        private void FillWithDummyData()
        {
            OrderSubtotal = "$100.00";
            ShippingCost  = "$20.00";
            TaxCost       = "$5.00";
            GrandTotal    = "$125.00";

            IsBottomAppBarOpened = true;

            SelectCheckoutDataLabel = "Select Shipping Address";

            var resourceLoader = new ResourceLoader();

            CheckoutDataViewModels = new List <CheckoutDataViewModel>()
            {
                new CheckoutDataViewModel()
                {
                    EntityId = "1", Title = resourceLoader.GetString("ShippingAddress"), FirstLine = "12345 Main St NE", SecondLine = "Seattle, WA 54321", BottomLine = "Name Lastname", LogoUri = new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute), DataType = resourceLoader.GetString("ShippingAddress")
                },
                new CheckoutDataViewModel()
                {
                    EntityId = "1", Title = resourceLoader.GetString("BillingAddress"), FirstLine = "12345 Main St NE", SecondLine = "Seattle, WA 54321", BottomLine = "Name Lastname", LogoUri = new Uri("ms-appx:///Assets/billingAddressLogo.png", UriKind.Absolute), DataType = resourceLoader.GetString("BillingAddress")
                },
                new CheckoutDataViewModel()
                {
                    EntityId = "1", Title = resourceLoader.GetString("PaymentMethod"), FirstLine = "Card ending in 1234", SecondLine = "Card expiring in 10/2014", BottomLine = "Name Lastname", LogoUri = new Uri("ms-appx:///Assets/paymentMethodLogo.png", UriKind.Absolute), DataType = resourceLoader.GetString("PaymentMethod")
                }
            };
            SelectedCheckoutData = CheckoutDataViewModels.First();

            ShippingMethods = new List <ShippingMethod>()
            {
                new ShippingMethod()
                {
                    Id = 1, Description = "Shipping Method 1", Cost = 1.50, EstimatedTime = "1 year"
                },
                new ShippingMethod()
                {
                    Id = 2, Description = "Shipping Method 2", Cost = 15.10, EstimatedTime = "1 month"
                },
                new ShippingMethod()
                {
                    Id = 3, Description = "Shipping Method 3", Cost = 151.0, EstimatedTime = "1 day"
                },
            };
            SelectedShippingMethod = ShippingMethods.First();

            ShoppingCartItemViewModels = new List <ShoppingCartItemViewModel>()
            {
                new ShoppingCartItemViewModel(new ShoppingCartItem()
                {
                    Id      = Guid.NewGuid().ToString(),
                    Product = new Product()
                    {
                        Title = "Product 1", Description = "Description of Product 1", ListPrice = 25.10, DiscountPercentage = 10, ProductNumber = "1", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")
                    },
                    Quantity = 1,
                    Currency = "USD"
                },
                                              null),
                new ShoppingCartItemViewModel(new ShoppingCartItem()
                {
                    Id      = Guid.NewGuid().ToString(),
                    Product = new Product()
                    {
                        Title = "Product 2", Description = "Description of Product 2", ListPrice = 25.10, DiscountPercentage = 10, ProductNumber = "2", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")
                    },
                    Quantity = 1,
                    Currency = "USD"
                },
                                              null),
                new ShoppingCartItemViewModel(new ShoppingCartItem()
                {
                    Id      = Guid.NewGuid().ToString(),
                    Product = new Product()
                    {
                        Title = "Product 3", Description = "Description of Product 3", ListPrice = 25.10, DiscountPercentage = 10, ProductNumber = "3", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")
                    },
                    Quantity = 1,
                    Currency = "USD"
                },
                                              null),
                new ShoppingCartItemViewModel(new ShoppingCartItem()
                {
                    Id      = Guid.NewGuid().ToString(),
                    Product = new Product()
                    {
                        Title = "Product 4", Description = "Description of Product 4", ListPrice = 25.10, DiscountPercentage = 10, ProductNumber = "4", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")
                    },
                    Quantity = 1,
                    Currency = "USD"
                },
                                              null),
                new ShoppingCartItemViewModel(new ShoppingCartItem()
                {
                    Id      = Guid.NewGuid().ToString(),
                    Product = new Product()
                    {
                        Title = "Product 5", Description = "Description of Product 5", ListPrice = 25.10, DiscountPercentage = 10, ProductNumber = "5", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")
                    },
                    Quantity = 1,
                    Currency = "USD"
                },
                                              null),
            };

            AllCheckoutDataViewModels = new List <CheckoutDataViewModel>()
            {
                new CheckoutDataViewModel()
                {
                    EntityId = "1", DataType = resourceLoader.GetString("ShippingAddress")
                },
                new CheckoutDataViewModel()
                {
                    EntityId = "1", DataType = resourceLoader.GetString("BillingAddress")
                },
                new CheckoutDataViewModel()
                {
                    EntityId = "1", DataType = resourceLoader.GetString("PaymentMethod")
                }
            };
            SelectedAllCheckoutData = AllCheckoutDataViewModels.First();
        }
        private void FillWithDummyData()
        {
            var resourceLoader = new ResourceLoader();

            ShippingAddresses = new List<CheckoutDataViewModel>()
                {
                    new CheckoutDataViewModel("1", resourceLoader.GetString("ShippingAddress"), "12345 Main St NE",
                                              "Seattle, WA 54321", "Name Lastname",
                                              new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute),
                                              null, null),
                    new CheckoutDataViewModel("2", resourceLoader.GetString("ShippingAddress"), "6789 Main St SE",
                                              "Seattle, WA 12345", "Name Lastname",
                                              new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute),
                                              null, null),
                    new CheckoutDataViewModel("3", resourceLoader.GetString("ShippingAddress"), "101112 Main St NW",
                                              "Seattle, WA 3578", "Name Lastname",
                                              new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute),
                                              null, null)
                };

            BillingAddresses = new List<CheckoutDataViewModel>()
                {
                    new CheckoutDataViewModel("1", resourceLoader.GetString("BillingAddress"), "12345 Main St NE",
                                              "Seattle, WA 54321", "Name Lastname",
                                              new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute),
                                              null, null),
                    new CheckoutDataViewModel("2", resourceLoader.GetString("BillingAddress"), "6789 Main St SE",
                                              "Seattle, WA 12345", "Name Lastname",
                                              new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute),
                                              null, null),
                    new CheckoutDataViewModel("3", resourceLoader.GetString("BillingAddress"), "101112 Main St NW",
                                              "Seattle, WA 3578", "Name Lastname",
                                              new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute),
                                              null, null)
                };

            PaymentMethods = new List<CheckoutDataViewModel>()
                {
                    new CheckoutDataViewModel("3", resourceLoader.GetString("PaymentMethod"), "Card ending in 1234",
                                              "Card expiring in 10/2014", "Name Lastname",
                                              new Uri("ms-appx:///Assets/paymentMethodLogo.png", UriKind.Absolute), null,
                                              null),
                    new CheckoutDataViewModel("3", resourceLoader.GetString("PaymentMethod"), "Card ending in 1234",
                                              "Card expiring in 11/2015", "Name Lastname",
                                              new Uri("ms-appx:///Assets/paymentMethodLogo.png", UriKind.Absolute), null,
                                              null),
                    new CheckoutDataViewModel("3", resourceLoader.GetString("PaymentMethod"), "Card ending in 1234",
                                              "Card expiring in 12/2016", "Name Lastname",
                                              new Uri("ms-appx:///Assets/paymentMethodLogo.png", UriKind.Absolute), null,
                                              null),
                };

            SelectedShippingAddress = ShippingAddresses.First();
            SelectedBillingAddress = BillingAddresses.First();
            SelectedPaymentMethod = PaymentMethods.First();
        }
        private void UpdateCheckoutData(CheckoutDataViewModel checkoutData)
        {
            // Update order & CheckoutData collection items with the new info
            switch (checkoutData.DataType)
            {
                case Constants.ShippingAddress:
                    _order.ShippingAddress = checkoutData.Context as Address;
                    CheckoutDataViewModels[0] = CreateCheckoutData(_order.ShippingAddress, Constants.ShippingAddress);
                    break;
                case Constants.BillingAddress:
                    _order.BillingAddress = checkoutData.Context as Address;
                    CheckoutDataViewModels[1] = CreateCheckoutData(_order.BillingAddress, Constants.BillingAddress);

                    break;
                case Constants.PaymentMethod:
                    _order.PaymentMethod = checkoutData.Context as PaymentMethod;
                    CheckoutDataViewModels[2] = CreateCheckoutData(_order.PaymentMethod);
                    break;
            }
        }
        private void FillWithDummyData()
        {
            OrderSubtotal = "$100.00";
            ShippingCost = "$20.00";
            TaxCost = "$5.00";
            GrandTotal = "$125.00";

            IsBottomAppBarOpened = true;

            IsSelectCheckoutDataPopupOpened = true;
            SelectCheckoutDataLabel = "Select Shipping Address";

            var resourceLoader = new ResourceLoader();
            CheckoutDataViewModels = new List<CheckoutDataViewModel>()
            {
                new CheckoutDataViewModel("1", resourceLoader.GetString("ShippingAddress"), "12345 Main St NE", "Seattle, WA 54321", "Name Lastname", new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute), null, null),
                new CheckoutDataViewModel("2", resourceLoader.GetString("BillingAddress"), "12345 Main St NE", "Seattle, WA 54321", "Name Lastname", new Uri("ms-appx:///Assets/billingAddressLogo.png", UriKind.Absolute), null, null),
                new CheckoutDataViewModel("3", resourceLoader.GetString("PaymentMethod"), "Card ending in 1234", "Card expiring in 10/2014", "Name Lastname", new Uri("ms-appx:///Assets/paymentMethodLogo.png", UriKind.Absolute), null, null),
            };
            SelectedCheckoutData = CheckoutDataViewModels.First();

            ShippingMethods = new List<ShippingMethod>()
            {
                new ShippingMethod() { Id = 1, Description = "Shipping Method 1", Cost = 1.50, EstimatedTime = "1 year"},
                new ShippingMethod() { Id = 2, Description = "Shipping Method 2", Cost = 15.10, EstimatedTime = "1 month"},
                new ShippingMethod() { Id = 3, Description = "Shipping Method 3", Cost = 151.0, EstimatedTime = "1 day"},
            };
            SelectedShippingMethod = ShippingMethods.First();

            ShoppingCartItemViewModels = new List<ShoppingCartItemViewModel>()
                {
                    new ShoppingCartItemViewModel(new ShoppingCartItem()
                        {
                            Id = Guid.NewGuid().ToString(),
                            Product = new Product() {  Title = "Product 1",  Description = "Description of Product 1", ListPrice = 25.10, ProductNumber = "1", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")},
                            Quantity = 1,
                            Currency = "USD"
                        }),
                   new ShoppingCartItemViewModel(new ShoppingCartItem()
                        {
                            Id = Guid.NewGuid().ToString(),
                            Product = new Product() {  Title = "Product 2",  Description = "Description of Product 2", ListPrice = 25.10, ProductNumber = "2", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")},
                            Quantity = 1,
                            Currency = "USD"
                        }), 
                   new ShoppingCartItemViewModel(new ShoppingCartItem()
                        {
                            Id = Guid.NewGuid().ToString(),
                            Product = new Product() {  Title = "Product 3",  Description = "Description of Product 3", ListPrice = 25.10, ProductNumber = "3", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")},
                            Quantity = 1,
                            Currency = "USD"
                        }), 
                   new ShoppingCartItemViewModel(new ShoppingCartItem()
                        {
                            Id = Guid.NewGuid().ToString(),
                            Product = new Product() {  Title = "Product 4",  Description = "Description of Product 4", ListPrice = 25.10, ProductNumber = "4", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")},
                            Quantity = 1,
                            Currency = "USD"
                        }), 
                   new ShoppingCartItemViewModel(new ShoppingCartItem()
                        {
                            Id = Guid.NewGuid().ToString(),
                            Product = new Product() {  Title = "Product 5",  Description = "Description of Product 5", ListPrice = 25.10, ProductNumber = "5", ImageUri = new Uri("ms-appx:///Assets/StoreLogo.png")},
                            Quantity = 1,
                            Currency = "USD"
                        }), 
                };
            
            AllCheckoutDataViewModels = new List<CheckoutDataViewModel>()
            {
                new CheckoutDataViewModel("1", resourceLoader.GetString("ShippingAddress"), "12345 Main St NE", "Seattle, WA 54321", "Name Lastname", new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute), null, null),
                new CheckoutDataViewModel("2", resourceLoader.GetString("ShippingAddress"), "12345 Main St NE", "Seattle, WA 54321", "Name Lastname", new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute), null, null),
                new CheckoutDataViewModel("3", resourceLoader.GetString("ShippingAddress"), "12345 Main St NE", "Seattle, WA 54321", "Name Lastname", new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute), null, null),
                new CheckoutDataViewModel("4", resourceLoader.GetString("ShippingAddress"), "12345 Main St NE", "Seattle, WA 54321", "Name Lastname", new Uri("ms-appx:///Assets/shippingAddressLogo.png", UriKind.Absolute), null, null),
            };
            SelectedAllCheckoutData = AllCheckoutDataViewModels.First();
        }