public DesignItem RegisterComponentForDesigner(DesignItem parent, object component)
        {
            if (component == null)
            {
                component = new NullExtension();
            }
            else if (component is Type)
            {
                component = new TypeExtension((Type)component);
            }

            XamlObject parentXamlObject = null;

            if (parent != null)
            {
                parentXamlObject = ((XamlDesignItem)parent).XamlObject;
            }

            XamlDesignItem item = new XamlDesignItem(_context.Document.CreateObject(parentXamlObject, component), _context);

            _context.Services.ExtensionManager.ApplyDesignItemInitializers(item);

            if (!(component is string))
            {
                _sites.Add(component, item);
            }
            if (ComponentRegistered != null)
            {
                ComponentRegistered(this, new DesignItemEventArgs(item));
            }
            return(item);
        }
示例#2
0
        public void Read_NullExtension()
        {
            var o = new NullExtension();
            var r = new XamlObjectReader(o);

            Read_NullOrNullExtension(r, o);
        }
        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);
        }
示例#4
0
        public void NullExtensionProvideValue()
        {
            tlog.Debug(tag, $"NullExtensionProvideValue START");

            try
            {
                var testingTarget = new NullExtension();
                Assert.IsNotNull(testingTarget, "null NullExtension");

                testingTarget.ProvideValue(new IServiceProviderImpl());
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            tlog.Debug(tag, $"NullExtensionProvideValue END");
        }
示例#5
0
        public DesignItem RegisterComponentForDesigner(object component)
        {
            if (component == null)
            {
                component = new NullExtension();
            }
            else if (component is Type)
            {
                component = new TypeExtension((Type)component);
            }

            XamlDesignItem item = new XamlDesignItem(_context.Document.CreateObject(component), _context);

            _sites.Add(component, item);
            if (ComponentRegistered != null)
            {
                ComponentRegistered(this, new DesignItemEventArgs(item));
            }
            return(item);
        }
示例#6
0
        public void NullExtensionProvideValue()
        {
            tlog.Debug(tag, $"NullExtensionProvideValue START");

            try
            {
                IServiceProviderimplement serviceProviderimplement = new IServiceProviderimplement();
                NullExtension             n1 = new NullExtension();

                n1.ProvideValue(serviceProviderimplement);

                n1 = null;
            }
            catch (Exception e)
            {
                Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
                Assert.Fail("Caught Exception" + e.ToString());
            }

            tlog.Debug(tag, $"NullExtensionProvideValue END (OK)");
            Assert.Pass("NullExtensionProvideValue");
        }
		public void Read_NullExtension ()
		{
			var o = new NullExtension ();
			var r = new XamlObjectReader (o);
			Read_NullOrNullExtension (r, o);
		}