public ListProductViewModel() : base() { listProductModel = ListProductModel.GetInstance(); listProductModel.LoadAllProduct(); //listDetailBill = ListDetailBillModel.GetInstance(); listDetailBill = new ListDetailBillModel(); // command init ProductSelectionChangeCommand = new DelegateCommand <ProductModel>(SelectedProductChange); ShortcutKeysCommand = new DelegateCommand <string>(HandleShortcutKeys); CreateBillCommand = new DelegateCommand(CreateBill); CheckoutBillCommand = new DelegateCommand(CheckoutBill); PrintBillCommand = new DelegateCommand(PrintBill); ClearBillCommand = new DelegateCommand(ClearBill); CancelCommand = new DelegateCommand(Cancel); DetailSelectionChangeCommand = new DelegateCommand <DetailBillItemViewModel>(SelectedDetailChange); RemoveItemCommand = new DelegateCommand <DetailBillItemViewModel>(RemoveDetailItem); // =============> !!!! [WARNING] DO NOT DELETE THIS CODE !!!! <============== SelectedIndex = 0; SelectedIndex = -1; NotifyChanged("SelectedIndex"); // ==================================> <====================================== }
private void ProductTypeChange(ProductTypeModel item) { if (item.ID == "LMH0") { ListProductModel.GetInstance().LoadAllProduct(); } else { ListProductModel.GetInstance().LoadProductFromType(item.ID); } }
public ProductManagementViewModel() : base() { listProductModel = ListProductModel.GetInstance(); listProductModel.LoadAllProduct(); bufferList = new ObservableCollection <ProductModel>(listProductModel.List); SelectedProduct = new ProductModel(); SelectedProduct = ListProduct[0]; NotifyProductChange(); fieldSearch = "Name"; ProductSelectionChangeCommand = new DelegateCommand <ProductModel>(ProductChange); SearchTextChangeCommand = new DelegateCommand <TextBox>(OnSearchTextChange); AddProductCommand = new DelegateCommand(ShowAddProductDialog); UpdateProductCommand = new DelegateCommand(UpdateProduct); RemoveProductCommand = new DelegateCommand(RemoveProduct); OpenSearchFilterCommand = new DelegateCommand(ShowSearchFilterDialog); }