ICollection IDesignerSerializationService.Deserialize(object serializationData) { if (serializationData == null) { throw new ArgumentNullException("serializationData"); } ComponentSerializationService service = LoaderHost.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService; SerializationStore store = serializationData as SerializationStore; if (service != null && serializationData != null) { return(service.Deserialize(store, this.LoaderHost.Container)); } return(new object[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); }
protected UndoEngine(IServiceProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } this._provider = provider; this._unitStack = new Stack(); this._enabled = true; this._host = this.GetRequiredService(typeof(IDesignerHost)) as IDesignerHost; this._componentChangeService = this.GetRequiredService(typeof(IComponentChangeService)) as IComponentChangeService; this._serializationService = this.GetRequiredService(typeof(ComponentSerializationService)) as ComponentSerializationService; this._host.TransactionOpening += new EventHandler(this.OnTransactionOpening); this._host.TransactionClosed += new DesignerTransactionCloseEventHandler(this.OnTransactionClosed); this._componentChangeService.ComponentAdding += new ComponentEventHandler(this.OnComponentAdding); this._componentChangeService.ComponentChanging += new ComponentChangingEventHandler(this.OnComponentChanging); this._componentChangeService.ComponentRemoving += new ComponentEventHandler(this.OnComponentRemoving); this._componentChangeService.ComponentAdded += new ComponentEventHandler(this.OnComponentAdded); this._componentChangeService.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged); this._componentChangeService.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemoved); this._componentChangeService.ComponentRename += new ComponentRenameEventHandler(this.OnComponentRename); }
private void SerializeDropDownItems(ToolStripDropDownItem parent, ref SerializationStore _serializedDataForDropDownItems, ComponentSerializationService _serializationService) { foreach (System.Windows.Forms.ToolStripItem item in parent.DropDownItems) { if (!(item is DesignerToolStripControlHost)) { _serializationService.Serialize(_serializedDataForDropDownItems, item); ToolStripDropDownItem item2 = item as ToolStripDropDownItem; if (item2 != null) { this.SerializeDropDownItems(item2, ref _serializedDataForDropDownItems, _serializationService); } } } }