Пример #1
0
        public EmployerItemViewModel(Employer employer, EmployerFacade employerFacade, IEmployerViewModelsFactory employerVMFactory)
        {
            _employerVMFactory = employerVMFactory;
            _employerFacade    = employerFacade;

            CanBeRemoved = false;

            _employerDetailViewModel = (EmployerDetailViewModel)_employerVMFactory.Create(employer, EmployerViewModel.DETAIL);
            _employerDetailViewModel.OnDeletionClicked += (object sender, EventArgs e) =>
            {
                if (_employerDeletionViewModel == null)
                {
                    _employerDeletionViewModel = (EmployerDeletionViewModel)_employerVMFactory.Create(employer, EmployerViewModel.DELETION);
                    _employerDeletionViewModel.OnReturnBackClicked += (object s, EventArgs ea) =>
                    {
                        ActivateItem(_employerDetailViewModel);
                    };
                    _employerDeletionViewModel.OnDeletedEmployer += (object s, EventArgs ea) =>
                    {
                        CanBeRemoved = true;
                        ActivateItem(_employerDetailViewModel);
                    };
                }
                ActivateItem(_employerDeletionViewModel);
            };
            ActivateItem(_employerDetailViewModel);
        }
Пример #2
0
        private EmployerItemViewModel CreateEmployerItemViewModel(Employer employer)
        {
            EmployerItemViewModel vm = (EmployerItemViewModel)_employersVMFactory.Create(employer, EmployerViewModel.ITEM);

            vm.OnDeletedEmployer += (s, e) => {
                _employers.Remove((EmployerItemViewModel)s);
            };

            return(vm);
        }