Пример #1
0
        public ModuleView(ModuleView_ViewModel viewModel, CommandProxy commandProxy)
        {
            _viewModel = viewModel;
            _commandProxy = commandProxy;

            InitializeComponent();
            ProductsBindingSource.DataSource = _viewModel;
            ProductsCB.DataBindings.Add("SelectedIndex", _viewModel, "SelectedProductIndex");
        }
        public ModuleView_ViewModel(IEventAggregator evtAggregator, CommandProxy commandProxy)
        {
            _eventAggregator = evtAggregator;
            _commandProxy = commandProxy;

            SaveCommand = new DelegateCommand<object>(Save, CanSave);
            _commandProxy.SaveAllCommand.RegisterCommand(SaveCommand);
            
            _eventAggregator.GetEvent<CreateProductEvent>().Subscribe(CreateProduct, ThreadOption.SubscriberAffinityThread);
        }
        public AnotherView_ViewModel(IEventAggregator evtAggregator, CommandProxy commandProxy)
        {
            _eventAggregator = evtAggregator;
            _commandProxy = commandProxy;
            SaveCommand = new DelegateCommand<object>(Save, CanSave);
            _commandProxy.SaveAllCommand.RegisterCommand(SaveCommand);

            _eventAggregator.GetEvent<ValidateProductEvent>().Subscribe(ValidateProduct, ThreadOption.PublisherThread);
            _eventAggregator.GetEvent<CreateProductFailedEvent>().Subscribe(NotifyCreateProductFailed, ThreadOption.SubscriberAffinityThread);
        }