Esempio n. 1
0
        /// <summary>
        /// Updates the content of the control
        /// (after initialization and SelectedObject changes)
        /// </summary>
        private void UpdateContent()
        {
            // Checks if the control has been loaded.
            if
            ((this.IsVisible == false) ||
             (this.InnerGrid == null)
            )
            {
                return;
            }

            // Clear the model.
            this.ClearContent();

            // Try to find view model converter for this given type.
            if (this.EditedObjects != null)
            {
                if (this.EditedObjects.Any())
                {
                    IViewModelConverter lConverter = ConverterViewModelRegistry.Instance.FindBestConverter(this.EditedObjects.First());
                    if (lConverter != null)
                    {
                        List <IPropertyViewModel> lViewModels = lConverter.Convert(this.EditedObjects.First());
                        foreach (var lViewModel in lViewModels)
                        {
                            lViewModel.Instances.Add(this.EditedObjects.First());
                            this.ViewModels.Add(lViewModel);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Constructor that sets the instances of the repositories and the converters
 /// </summary>
 /// <param name="treatmentRepository"></param>
 /// <param name="departmentRepository"></param>
 /// <param name="institutionRepository"></param>
 public TreatmentTypeController(TreatmentTypeRepository treatmentRepository,
                                DepartmentRepository departmentRepository,
                                InstitutionRepository institutionRepository)
 {
     this.repository            = treatmentRepository;
     this.departmentRepository  = departmentRepository;
     this.institutionRepository = institutionRepository;
     converter = new TreatmentTypeViewModelConverter();
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="departmentRepository">Department repository</param>
 /// <param name="institutionRepository">Institution repository</param>
 /// <param name="converter">Converter</param>
 public DepartmentController(DepartmentRepository departmentRepository,
                             InstitutionRepository institutionRepository,
                             DoctorRepository doctorRepository,
                             IViewModelConverter <Department, DepartmentDetailViewModel> converter)
 {
     this.departmentRepository  = departmentRepository;
     this.institutionRepository = institutionRepository;
     this.doctorRepository      = doctorRepository;
     this.converter             = converter;
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dataContext"></param>
 /// <param name="pageLoadService"></param>
 /// <param name="entityStateQueue"></param>
 /// <param name="vmConverter"></param>
 public GoalMessageService(
     DataContext dataContext,
     IPageLoadService <GoalMessage> pageLoadService,
     IBackgroundTaskQueue <VmEntityStateMessage> entityStateQueue,
     IViewModelConverter <GoalMessage, VmGoalMessage> vmConverter)
 {
     _dataContext      = dataContext;
     _pageLoadService  = pageLoadService;
     _entityStateQueue = entityStateQueue;
     _vmConverter      = vmConverter;
 }
Esempio n. 5
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="dataContext"></param>
 /// <param name="usersRepository"></param>
 /// <param name="vmTeamRoleConverter"></param>
 /// <param name="vmUserConverter"></param>
 public ProjectTeamsService(DataContext dataContext,
                            IUsersRepository usersRepository,
                            IViewModelConverter <ProjectTeam, VmProjectTeamRole> vmTeamRoleConverter,
                            IViewModelConverter <ApplicationUser, VmUser> vmUserConverter)
 {
     _dataContext         = dataContext;
     _usersRepository     = usersRepository;
     _vmTeamRoleConverter = vmTeamRoleConverter;
     _vmUserConverter     = vmUserConverter;
     _vmConverter         = new VmTeamConverter();
 }
Esempio n. 6
0
 public GroupsService(DataContext dataContext,
                      IViewModelConverter <Group, VmGroup> vmConverter,
                      IPageLoadService <Group> pageLoadService,
                      IBackgroundTaskQueue <VmEntityStateMessage> entityStateQueue,
                      IRolesService rolesService)
 {
     _dataContext      = dataContext;
     _vmConverter      = vmConverter;
     _pageLoadService  = pageLoadService;
     _entityStateQueue = entityStateQueue;
     _rolesService     = rolesService;
 }
Esempio n. 7
0
        /// <summary>
        /// Converts the type to
        /// </summary>
        /// <param name="pObject">The object to convert.</param>
        /// <returns>The list of retrieved property view model.</returns>
        public List <IPropertyViewModel> Convert(object pObject)
        {
            List <IPropertyViewModel>    lResult     = new List <IPropertyViewModel>();
            PropertyDescriptorCollection lProperties = TypeDescriptor.GetProperties(pObject);

            foreach (var lPropertyInfo in lProperties)
            {
                IViewModelConverter lConverter = ConverterViewModelRegistry.Instance.FindBestConverter(lPropertyInfo);
                if (lConverter != null)
                {
                    lResult.AddRange(lConverter.Convert(lPropertyInfo));
                }
            }
            return(lResult);
        }
Esempio n. 8
0
 public VmGroupConverter(IViewModelConverter <Project, VmProject> vmProjectConverter,
                         IViewModelConverter <Metadata, VmMetadata> vmMetadataConverter)
 {
     _vmProjectConverter  = vmProjectConverter;
     _vmMetadataConverter = vmMetadataConverter;
 }
Esempio n. 9
0
        public IViewModelConverter FindBestConverter(object pInstance)
        {
            IViewModelConverter lConverter = this.Converters.OrderBy(pConverter => pConverter.CanConvert(pInstance)).LastOrDefault();

            return(lConverter);
        }
Esempio n. 10
0
 public ProjectUserRolesService(DataContext dataContext,
                                IViewModelConverter <ProjectUserRole, VmProjectUserRole> vmConverter)
 {
     _dataContext = dataContext;
     _vmConverter = vmConverter;
 }
Esempio n. 11
0
 public OrderService(IOrderRepository orderRepository, IViewModelConverter vmConverter)
 {
     repo             = orderRepository;
     this.vmConverter = vmConverter;
 }
Esempio n. 12
0
 public TeamUsersService(DataContext dataContext,
                         IViewModelConverter <ApplicationUser, VmUser> vmUserConverter)
 {
     _dataContext     = dataContext;
     _vmUserConverter = vmUserConverter;
 }
 public ViewModelResultFilter(IViewModelConverter viewModelConverter)
 {
     _viewModelConverter = viewModelConverter;
 }
Esempio n. 14
0
 public VmGoalMessageConverter(
     IViewModelConverter <UserGoalMessage, VmUserGoalMessage> vmUserMessageConverter)
 {
     this._vmUserMessageConverter = vmUserMessageConverter;
 }