Beispiel #1
0
 public ComponentDetailViewModel(IComponentDataService dataService,
                                 IEventAggregator eventAggregator, IErrorDataService errorDataService, IComponentRepository componentRepository)
 {
     _dataService     = dataService;
     _eventAggregator = eventAggregator;
     _eventAggregator.GetEvent <OpenComponentDetailViewEvent>()
     .Subscribe(OnOpenComponentDetailView);
     _errorDataService = errorDataService;
     _eventAggregator.GetEvent <AfterUserLogin>().Subscribe(OnLogin);
     _componentRepository = componentRepository;
     UpdateCommand        = new DelegateCommand(OnUpdateExecute);
 }
 public ComponentListViewModel(IComponentDataService componentDataService,
                               IEventAggregator eventAggregator, IErrorDataService errorDataService, IComponentDetailViewModel componentDetailViewModel)
 {
     _componentDataService = componentDataService;
     Components            = new ObservableCollection <ComponentDto>();
     //initialize event aggregator
     _eventAggregator  = eventAggregator;
     _errorDataService = errorDataService;
     _eventAggregator.GetEvent <AfterComponentCreated>().Subscribe(RefreshList);
     ComponentDetailViewModel = componentDetailViewModel;
     _eventAggregator.GetEvent <AfterUserLogin>().Subscribe(OnLogin);
 }
        public AddRemoveComponentViewModel(IEquipmentLookupDataService equipmentLookupDataService, IErrorDataService errorDataService,
                                           IComponentDataService componentDataService, IEquipmentRepository equipmentRepository, IEventAggregator eventAggregator)
        {
            _equipmentLookupDataService = equipmentLookupDataService;
            _componentDataService       = componentDataService;
            _errorDataService           = errorDataService;
            _equipmentRepository        = equipmentRepository;
            Equipments             = new ObservableCollection <EquipmentLookup>();
            Components             = new ObservableCollection <ComponentDto>();
            ComponentsForEquipment = new ObservableCollection <ComponentDto>();
            EquipmentComponents    = new ObservableCollection <EquipmentComponent>();

            AddComponent    = new DelegateCommand(OnComponentAdded, OnComponentCanAdded);
            RemoveComponent = new DelegateCommand(OnComponentRemoved, OnComponentCanRemoved);
            SaveChanges     = new DelegateCommand(OnChangesSaved, OnChangesCanSaved);

            _eventAggregator = eventAggregator;
            _eventAggregator.GetEvent <AfterUserLogin>().Subscribe(OnLogin);
        }