/// <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; }
/// <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; }
/// <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(); }
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; }
/// <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); }
public VmGroupConverter(IViewModelConverter <Project, VmProject> vmProjectConverter, IViewModelConverter <Metadata, VmMetadata> vmMetadataConverter) { _vmProjectConverter = vmProjectConverter; _vmMetadataConverter = vmMetadataConverter; }
public IViewModelConverter FindBestConverter(object pInstance) { IViewModelConverter lConverter = this.Converters.OrderBy(pConverter => pConverter.CanConvert(pInstance)).LastOrDefault(); return(lConverter); }
public ProjectUserRolesService(DataContext dataContext, IViewModelConverter <ProjectUserRole, VmProjectUserRole> vmConverter) { _dataContext = dataContext; _vmConverter = vmConverter; }
public OrderService(IOrderRepository orderRepository, IViewModelConverter vmConverter) { repo = orderRepository; this.vmConverter = vmConverter; }
public TeamUsersService(DataContext dataContext, IViewModelConverter <ApplicationUser, VmUser> vmUserConverter) { _dataContext = dataContext; _vmUserConverter = vmUserConverter; }
public ViewModelResultFilter(IViewModelConverter viewModelConverter) { _viewModelConverter = viewModelConverter; }
public VmGoalMessageConverter( IViewModelConverter <UserGoalMessage, VmUserGoalMessage> vmUserMessageConverter) { this._vmUserMessageConverter = vmUserMessageConverter; }