Ejemplo n.º 1
0
        void OnGroceryListChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // Update item count
            this.ItemCount = this.OBProductList.Count;

            // Resequence list
            SequencingService.SetCollectionSequence(this.OBProductList);
        }
Ejemplo n.º 2
0
        private void Initialize()
        {
            // Initialize commands
            this.DeleteItem = new DeleteItemCommand(this);

            // Create grocery list
            p_ProductList = new ObservableCollection <Product>();

            // Subscribe to CollectionChanged event
            p_ProductList.CollectionChanged += OnGroceryListChanged;
            // Initialize list index
            this.OBProductList = SequencingService.SetCollectionSequence(this.OBProductList);

            // Update bindings
            base.RaisePropertyChangedEvent("OBProductList");
        }
Ejemplo n.º 3
0
        void OnProductListChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.ItemCount = this.p_ProductList.Count;

            // Resequence list
            SequencingService.SetCollectionSequence(this.p_ProductList);

            /*
             * double totalPrice = 0;
             * ObservableCollection<Product> obsColl = p_ProductList;
             * foreach (Product data in obsColl)
             * {
             *  double subtotal = data.UnitPrice * data.Quantity;
             *  totalPrice = totalPrice + subtotal;
             * }
             * this._totalPrice = totalPrice;
             */
            base.RaisePropertyChangedEvent("TotalPrice");
        }
Ejemplo n.º 4
0
        public ViewModel()
        {
            _totalPrice = 0;
            if (null == p_ProductList)
            {
                GetProductDetails();

                this.AddItem      = new AddItemCommand(this);
                this.PrintInvoice = new PrintInvoiceCommand(this);
                // Create grocery list
                p_ProductList = new ObservableCollection <Product>();

                // Subscribe to CollectionChanged event
                p_ProductList.CollectionChanged += OnProductListChanged;
                // Initialize list index
                this.OBProductList = SequencingService.SetCollectionSequence(this.OBProductList);
                // Update bindings
                base.RaisePropertyChangedEvent("OBProductList");
            }
        }