// private SainaDbContext _uow; public ProductModelListView() { // _uow = new SainaDbContext(); _shoppingSystemSettingsService = SmObjectFactory.Container.GetInstance <IShoppingSystemSettingsService>(); InitializeComponent(); Loaded += (s, e) => { _viewModel = DataContext as ProductModelListViewModel; _viewModel.Loaded(); // BeginEdit(); //if (ProductModelDataForm?.ItemsSource != null) //{ // var productModels = ProductModelDataForm.ItemsSource.Cast<ProductModel>(); // foreach (var productModel in ProductModels) // { // productModel.PropertyChanged += ProductModel_PropertyChanged; // } //} _viewModel.Error += OnError; // DataContext = _viewModel; }; Unloaded += (s, ea) => { _viewModel.Error -= OnError; }; }
public ProductTypeListViewModel(IShoppingSystemSettingsService shoppingSystemSettingsService, SainaDbContext uow) { _shoppingSystemSettingsService = shoppingSystemSettingsService; AddBrandCommand = new RelayCommand(OnAddProduct); ProductType = new ProductType(); _uow = uow; }
public OtherProductListViewModel(IShoppingSystemSettingsService shoppingSystemSettingsService, SainaDbContext uow) { _shoppingSystemSettingsService = shoppingSystemSettingsService; AddBrandCommand = new RelayCommand(OnAddProduct); OtherProduct = new OtherProduct(); _uow = uow; }
public ShoppingSystemSettingViewModel(IAppContextService appContextService, IShoppingSystemSettingsService shoppingSystemSettingsService, ISLsService sLsService) { _sLsService = sLsService; _appContextService = appContextService; _shoppingSystemSettingsService = shoppingSystemSettingsService; // ShoppingSystemSettingModel = _shoppingSystemSettingsService.GetShoppingSystemSettingModel(); SLsDropDownOpenedCommand = new RelayCommand(OnSLsDropDownOpened); SaveCommand = new RelayCommand(onSave); ShoppingSystemSettingModel = AutoMapper.Mapper.Map <ShoppingSystemSettingModel, EditableShoppingSystemSettingViewModel>(_shoppingSystemSettingsService.GetShoppingSystemSettingModel()); ShoppingSystemSettingModel.ValidationDelegate += ShoppingSystemSettingModel_ValidationDelegate; }
public ProductListViewModel(IShoppingSystemSettingsService shoppingSystemSettingsService, SainaDbContext uow) { _shoppingSystemSettingsService = shoppingSystemSettingsService; AddBrandCommand = new RelayCommand(OnAddProduct); ApplyCommand = new RelayCommand(OnApply); ProductDropDownOpenedCommand = new RelayCommand(OnProductModelsDropDownOpened, () => ProductBrands != null && ProductBrands.Any()); _uow = uow; ProductBrands = new ObservableCollection <ProductBrand>(); OtherProducts = new ObservableCollection <OtherProduct>(); ProductTypes = new ObservableCollection <ProductType>(); ProductModels = new ObservableCollection <ProductModel>(); MeasurementUnits = new ObservableCollection <MeasurementUnit>(); // Stocks = new ObservableCollection<Stock>(); //InventoryControl = new InventoryControl(); }