public void Initialize() { using (_resourceLocker.Locker) { var resources = _resourceLocker.Resources; if (!GlobalInitializerFacade.IsReinitializingTheSystem) { DataEvents <IDataItemTreeAttachmentPoint> .OnAfterAdd += OnUpdateTreeAttachmentPoints; DataEvents <IDataItemTreeAttachmentPoint> .OnDeleted += OnUpdateTreeAttachmentPoints; DataEvents <IDataItemTreeAttachmentPoint> .OnStoreChanged += OnTreeAttachmentPointsStoreChange; GeneratedTypesFacade.SubscribeToUpdateTypeEvent(OnDataTypeChanged); var treeAuxiliaryAncestorProvider = new TreeAuxiliaryAncestorProvider(); var entityTokenTypes = new[] { typeof(TreeSimpleElementEntityToken), typeof(TreeFunctionElementGeneratorEntityToken), typeof(TreeDataFieldGroupingElementEntityToken), typeof(DataEntityToken), typeof(TreePerspectiveEntityToken) }; entityTokenTypes.ForEach(type => AuxiliarySecurityAncestorFacade .AddAuxiliaryAncestorProvider(type, treeAuxiliaryAncestorProvider, true)); resources.PersistentAttachmentPoints = new Dictionary <string, List <IAttachmentPoint> >(); LoadAllTrees(); InitializeTreeAttachmentPoints(); TreeSharedRootsFacade.Clear(); var fileWatcher = new C1FileSystemWatcher(TreeDefinitionsFolder, "*.xml"); fileWatcher.Created += OnReloadTrees; fileWatcher.Deleted += OnReloadTrees; fileWatcher.Changed += OnReloadTrees; fileWatcher.Renamed += OnReloadTrees; fileWatcher.EnableRaisingEvents = true; resources.FileSystemWatcher = fileWatcher; resources.RootEntityToken = ElementFacade.GetRootsWithNoSecurity().First().ElementHandle.EntityToken; } } }
private void ReloadAllTrees() { using (ThreadDataManager.EnsureInitialize()) { LoadAllTrees(); InitializeTreeAttachmentPoints(); TreeSharedRootsFacade.Clear(); using (_resourceLocker.ReadLocker) { var refreshTreeMessageQueueItem = new RefreshTreeMessageQueueItem { EntityToken = _resourceLocker.Resources.RootEntityToken }; ConsoleMessageQueueFacade.Enqueue(refreshTreeMessageQueueItem, null); } } }