Пример #1
0
        public EmployeeViewModel(IEmployeeListViewModel employeeListViewModel,
                                 IEmployeeRepository employeeDataService,
                                 Func <IEmployeeDetailViewModel> employeeDetailViewModelFunc, IEventAggregator eventAggregator)
        {
            _eventAggregator             = eventAggregator;
            _employeeDetailViewModelFunc = employeeDetailViewModelFunc;

            _eventAggregator.GetEvent <EmployeeDetailEvent>().Subscribe(EmployeeDetailActivated);
            _eventAggregator.GetEvent <EmployeeDeletedEvent>().Subscribe(EmployeeDeleted);

            CreateEmployeeCommand = new DelegateCommand(OnCreateEmployee);
            EmployeeListViewModel = employeeListViewModel;
        }
        public EmployeeView(IEmployeeListViewModel _employeeListViewModel,
                            IEmployeeRepository _employeeDataService,
                            Func <IEmployeeDetailViewModel> _employeeDetailViewModel,
                            IEventAggregator _eventAggregator)
        {
            InitializeComponent();

            EmployeeDataService     = _employeeDataService;
            EmployeeListViewModel   = _employeeListViewModel;
            EmployeeDetailViewModel = _employeeDetailViewModel;
            EventAggregator         = _eventAggregator;

            _employeeViewModel = new EmployeeViewModel(EmployeeListViewModel, EmployeeDataService, EmployeeDetailViewModel, EventAggregator);
            this.DataContext   = _employeeViewModel;

            Loaded += EmployeeView_Loaded;
        }
Пример #3
0
        public EmployeesController(IEmployeeService service, IImageService imageService, IEmployeeListViewModel model)
        {
            if (service == null)
            {
                throw new ArgumentException("employee");
            }

            if (imageService == null)
            {
                throw new ArgumentException("imageservice");
            }

            if (model == null)
            {
                throw new ArgumentException("viewmodel");
            }

            this.employeeService = service;
            this.imageService    = imageService;
            this.model           = model;
        }
Пример #4
0
        // Views are loaded here via RelayCommand along with their view models and data services
        public MainViewModel(ICustomerListViewModel _customerListViewModel,
                             ICustomerRepository _customerDataService,
                             Func <ICustomerDetailViewModel> _customerDetailViewModel,
                             IEmployeeRepository _employeeDataService,
                             IEmployeeListViewModel _employeeListViewModel,
                             Func <IEmployeeDetailViewModel> _employeeDetailViewModel,
                             IEventAggregator _eventAggregator,
                             IPatrolScheduleDataViewModel _patrolScheduleDataViewModel,
                             IPatrolRepository _patrolRepository,
                             Func <IPatrolScheduleDetailViewModel> _patrolScheduleDetailViewModel,
                             IEmpScheduleReport empScheduleReport,
                             ICustomersLookupReport customerLookupReport,
                             ISearchViewModel _searchViewModel)
        {
            _custView             = new CustomerView(_customerListViewModel, _customerDataService, _customerDetailViewModel, _eventAggregator);
            _employeeView         = new EmployeeView(_employeeListViewModel, _employeeDataService, _employeeDetailViewModel, _eventAggregator);
            _scheduleView         = new PatrolScheduleView(_patrolScheduleDataViewModel, _patrolRepository, _patrolScheduleDetailViewModel, _eventAggregator);
            _searchView           = new SearchView(_searchViewModel);
            _empScheduleReport    = empScheduleReport;
            _customerLookupReport = customerLookupReport;

            SelectCustomerView = new RelayCommand(() => SelectedView = _custView);
            SelectEmployeeView = new RelayCommand(() => SelectedView = _employeeView);
            SelectScheduleView = new RelayCommand(() => SelectedView = _scheduleView);
            SelectSearchView   = new RelayCommand(() => SelectedView = _searchView);

            GenerateEmployeeSchedules = new RelayCommand(async() => await RunEmpScheduleReport());
            GenerateCustomerReport    = new RelayCommand(async() => await RunCustomerReport());


            EmpSchedules = new ObservableCollection <EmpScheduleModel>();
            Customers    = new ObservableCollection <CustomerReportModel>();


            ExitCommand = new RelayCommand(() => Shutdown());
        }