Ejemplo n.º 1
0
        public void Apply(IInternalObjectContainer container)
        {
            if (!(container is LocalObjectContainer) || container.ConfigImpl.IsReadOnly())
            {
                return;
            }
            var localObjectContainer = (LocalObjectContainer) container;
            var freespaceManager = localObjectContainer.FreespaceManager();
            var freespaceListener = new FreespaceListener(localObjectContainer);
            freespaceManager.Traverse(new FreespaceInitializingVisitor(freespaceListener));

            var eventRegistry = EventRegistryFactory.ForObjectContainer(container);
            eventRegistry.Closing += delegate
            {
                freespaceListener.Dispose();
                freespaceManager.Listener(NullFreespaceListener.Instance);
            };

            freespaceManager.Listener(freespaceListener);
        }
Ejemplo n.º 2
0
        public void Apply(IInternalObjectContainer container)
        {
            if (!(container is LocalObjectContainer) || container.ConfigImpl.IsReadOnly())
            {
                return;
            }
            LocalObjectContainer localObjectContainer = (LocalObjectContainer)container;
            IFreespaceManager    freespaceManager     = localObjectContainer.FreespaceManager();
            FreespaceListener    freespaceListener    = new FreespaceListener(localObjectContainer);

            freespaceManager.Traverse(new FreespaceInitializingVisitor(freespaceListener));

            IEventRegistry eventRegistry = EventRegistryFactory.ForObjectContainer(container);

            eventRegistry.Closing += delegate
            {
                freespaceListener.Dispose();
                freespaceManager.Listener(NullFreespaceListener.Instance);
            };

            freespaceManager.Listener(freespaceListener);
        }