/// <summary> /// Initialize control and fill data /// </summary> /// <param name="fileStructure">File structure instance</param> public FileStructureViewModel Initialize(FileStructure fileStructure) { var viewModel = new FileStructureViewModel(directoryTreeView, expanderMetadata); viewModel.Initialize(fileStructure); DataContext = viewModel; if (!fileStructure.IsTemplate) { // Initialize grid var stackId = stackService.GetStackId("STACK_Document"); searchOverviewGrid.FillOnProfileChanged = false; searchOverviewGrid.SetBlobSettings(true, true); searchOverviewGrid.SetConfig("Grid_Document_FileStructure_Overview", "Search_Documents", stackId, Guid.Empty, new Guid[] { }); // Set file-structure variable searchOverviewGrid.GridView.SelectedProfileChanged += (s, e) => { searchOverviewGrid.GridView.EmbeddedGridView?.SetPlaceholder("[FileStructureId]", fileStructure.Id.ToString()); }; searchOverviewGrid.GridView.Loaded += (s, e) => { searchOverviewGrid.GridView.EmbeddedGridView?.SetPlaceholder("[FileStructureId]", fileStructure.Id.ToString()); }; } // Reset dirty status viewModel.IsDirty = false; return(viewModel); }
/// <summary> /// Initialize viewmodel /// </summary> /// <param name="model"></param> public DirectoryViewModel(Directory model, FileStructureViewModel structureViewModel) { localizationService = CommonServiceLocator.ServiceLocator.Current.GetInstance <ILocalizationService>(); directoryTypeService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IDirectoryTypeService>(); iconService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IIconService>(); directoryTypeFieldService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IDirectoryClassificationFieldService>(); directoryFieldService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IDirectoryFieldService>(); fieldTypeService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IFieldTypeService>(); directories = new ObservableCollection <DirectoryViewModel>(); this.structureViewModel = structureViewModel; this.model = model; }