コード例 #1
0
        public DesignItem RegisterComponentForDesigner(object component, Type basetype = null)
        {
            if (component == null)
            {
                component = new NullExtension();
            }
            else if (component is Type)
            {
                component = new TypeExtension((Type)component);
            }

            object baseobject = basetype != null && component.GetType() != basetype?CustomInstanceFactory.CreateObjectInstance(basetype, null) : null;

            XamlObject xamlobj = _context.Document.CreateObject(component, baseobject);

            XamlDesignItem item = new XamlDesignItem(xamlobj, _context);

            if (!(component is string))
            {
                _sites.Add(component, item);
            }
            if (ComponentRegistered != null)
            {
                ComponentRegistered(this, new DesignItemEventArgs(item));
            }
            return(item);
        }
コード例 #2
0
        public void TestCustomInstanceByType()
        {
            var factory = new CustomInstanceFactory();

            var codec = factory.GetCodec("Lucene46");

            assertNotNull(codec);
            assertEquals(typeof(CustomNamedCodec), codec.GetType());
        }
コード例 #3
0
        public void TestCustomInstanceByName()
        {
            var factory = new CustomInstanceFactory();

            var codec = factory.GetCodec("ThisIsATest");

            assertNotNull(codec);
            assertEquals(typeof(NotIgnoredCodec), codec.GetType());
        }
コード例 #4
0
        public void TestCustomInstanceByType()
        {
            var factory = new CustomInstanceFactory();

            var DocValuesFormat = factory.GetDocValuesFormat("Lucene45");

            assertNotNull(DocValuesFormat);
            assertEquals(typeof(CustomNamedDocValuesFormat), DocValuesFormat.GetType());
        }
コード例 #5
0
        public void TestCustomInstanceByName()
        {
            var factory = new CustomInstanceFactory();

            var DocValuesFormat = factory.GetDocValuesFormat("ThisIsATest");

            assertNotNull(DocValuesFormat);
            assertEquals(typeof(NotIgnoredDocValuesFormat), DocValuesFormat.GetType());
        }
コード例 #6
0
        public void TestCustomInstanceByType()
        {
            var factory = new CustomInstanceFactory();

            var PostingsFormat = factory.GetPostingsFormat("Lucene40");

            assertNotNull(PostingsFormat);
            assertEquals(typeof(CustomNamedPostingsFormat), PostingsFormat.GetType());
        }
コード例 #7
0
        public void TestCustomInstanceByName()
        {
            var factory = new CustomInstanceFactory();

            var PostingsFormat = factory.GetPostingsFormat("ThisIsATest");

            assertNotNull(PostingsFormat);
            assertEquals(typeof(NotIgnoredPostingsFormat), PostingsFormat.GetType());
        }