Example #1
0
        public FrmProduct()
        {
            InitializeComponent();

            this.Load         += delegate { _vm.Load(); };
            btnSearch.Click   += delegate { _vm.Search(txtSearch.Text); };
            btnAddImage.Click += delegate { _vm.AddImage(); };
            btnAdd.Click      += delegate { _vm.AddRow(); };
            btnSave.Click     += delegate { _vm.Save(); };

            _vm._source         = productModelBindingSource;
            _vm._unitSource     = unitBindingSource;
            _vm._supplierSource = supplierBindingSource;
            _vm._categorySource = categoryBindingSource;
            _vm.Initialize();

            btnRecycling.Click += delegate { _vm.RecyclingCommand.Execute(); };
            btnRecycling.DataBindings.Add(_vm.RecyclingCommand.EnabledBinding);
            barcodeTextBox.TextChanged += delegate { _vm.BarcodeCommand.Execute(); };
            barcodeTextBox.DataBindings.Add(_vm.BarcodeCommand.EnabledBinding);
        }