示例#1
0
                public void SetModifiedState(UndoEngine engine, IComponent component, MemberDescriptor member)
                {
                    // Console.WriteLine ("ComponentChangeAction.SetModifiedState (" + (_componentName != null ? (_componentName + ".") : "") +
                    //         member.Name + "): " +
                    //         (((PropertyDescriptor)member).GetValue (component) == null ? "null" :
                    //         ((PropertyDescriptor)member).GetValue (component).ToString ()));
                    ComponentSerializationService serializationService = engine.GetRequiredService(
                        typeof(ComponentSerializationService)) as ComponentSerializationService;

                    _afterChange = serializationService.CreateStore();
                    serializationService.SerializeMemberAbsolute(_afterChange, component, member);
                    _afterChange.Close();
                }
示例#2
0
                public ComponentAddRemoveAction(UndoEngine engine, IComponent component, bool added)
                {
                    if (component == null)
                    {
                        throw new ArgumentNullException("component");
                    }
                    // Console.WriteLine ((added ? "Component*Add*RemoveAction" : "ComponentAdd*Remove*Action") +
                    //         " (" + component.Site.Name + ")");
                    ComponentSerializationService serializationService = engine.GetRequiredService(
                        typeof(ComponentSerializationService)) as ComponentSerializationService;

                    _serializedComponent = serializationService.CreateStore();
                    serializationService.Serialize(_serializedComponent, component);
                    _serializedComponent.Close();

                    _added         = added;
                    _componentName = component.Site.Name;
                }
示例#3
0
        object IDesignerSerializationService.Serialize(ICollection objects)
        {
            if (objects == null)
            {
                throw new ArgumentNullException("objects");
            }

            ComponentSerializationService service = LoaderHost.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;

            if (service != null)
            {
                SerializationStore store = service.CreateStore();
                foreach (object o in objects)
                {
                    service.Serialize(store, o);
                }
                store.Close();
                return(store);
            }
            return(null);
        }