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; }
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); }