Пример #1
0
        public void AddInstance(object obj, string name)
        {
            CreatedInstance createdInstance = new CreatedInstance(obj.GetType(), new object[0], name, false);

            createdInstance.Object = obj;
            createdInstances.Add(createdInstance);
        }
Пример #2
0
        public object GetInstance(string name)
        {
            CreatedInstance instance = GetCreatedInstance(name);

            if (instance != null)
            {
                return(instance.Object);
            }
            return(null);
        }
Пример #3
0
        public override bool Equals(object obj)
        {
            CreatedInstance rhs = obj as CreatedInstance;

            if (rhs != null)
            {
                return(ToString() == rhs.ToString());
            }
            return(base.Equals(obj));
        }
Пример #4
0
        public object CreateInstance(Type type, ICollection arguments, string name, bool addToContainer)
        {
            CreatedInstance createdInstance = new CreatedInstance(type, arguments, name, addToContainer);

            createdInstances.Add(createdInstance);

            object[] argumentsArray = new object[arguments.Count];
            arguments.CopyTo(argumentsArray, 0);

            object o = null;
            DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager();

            using (designerSerializationManager.CreateSession()) {
                IDesignerSerializationManager manager = designerSerializationManager as IDesignerSerializationManager;
                o = manager.CreateInstance(type, arguments, name, addToContainer);
            }
            createdInstance.Object = o;
            return(o);
        }