public BillViewModel(BillService billService, ProductService productService, domain.Bill domainBill, IEventAggregator eventAggregator) { this.eventAggregator = eventAggregator; this.billService = billService; this.productService = productService; this.domainBill = domainBill; this.domainBill.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(domainBill_PropertyChanged); this.BillItemVMList = BuildBillItemVmList(this.domainBill); }
public BillListViewModel( IEventAggregator eventAggregator, BillService billService, ProductVMContainer productVMContainer, IUnityContainer container ) { this.productVMContainer = productVMContainer; this.billService = billService; this.eventAggregator = eventAggregator; this.container = container; this.eventAggregator.GetEvent<ProductItemDoubleClickEvent>().Subscribe(OnProductItemDoubleClickEventHandler); this.eventAggregator.GetEvent<ProductSellPriceChangedEvent>().Subscribe(ProductSellPriceChangedEventHandler); this.eventAggregator.GetEvent<SelectedItemsToNewBillEvent>().Subscribe(OnSelectedItemsToNewBillEventHandler); var dmBillList = billService.GetAllBills(); var list = dmBillList.Select(x => CreateVM(container, x) ).ToList(); this.BillList = new ObservableCollection<BillViewModel>(list); this.BillListCollectionView = CollectionViewSource.GetDefaultView(this.billList); this.BillListCollectionView.Filter = FilterFunction; }