public object Serialize ( System.Collections.ICollection objects ) {
     ComponentSerializationService componentSerializationService = _serviceProvider.GetService ( typeof ( ComponentSerializationService ) ) as ComponentSerializationService;
     SerializationStore returnObject = null;
     using ( SerializationStore serializationStore = componentSerializationService.CreateStore() ) {
         foreach ( object obj in objects ) {
             if ( obj is Control )
                 componentSerializationService.Serialize ( serializationStore, obj );
         }
         returnObject = serializationStore;
     }
     return returnObject;
 }
Esempio n. 2
0
        public System.Collections.ICollection Deserialize(object serializationData)
        {
            SerializationStore serializationStore = serializationData as SerializationStore;

            if (serializationStore != null)
            {
                ComponentSerializationService componentSerializationService = serviceProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;
                ICollection collection = componentSerializationService.Deserialize(serializationStore);
                return(collection);
            }
            return(new object[0]);
        }
Esempio n. 3
0
        public object Serialize(ICollection objects)
        {
            ComponentSerializationService service = (ComponentSerializationService)this.serviceProvider.GetService(typeof(ComponentSerializationService));
            SerializationStore            store   = service.CreateStore();

            foreach (object obj2 in objects)
            {
                service.Serialize(store, obj2);
            }
            store.Close();
            return(store);
        }
Esempio n. 4
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 ();
				}
Esempio n. 5
0
        private void LoadRuntime(int type)
        {
            var controls            = surface.ComponentContainer.Components;
            SerializationStore data = (SerializationStore)surface._designerSerializationService.Serialize(controls);


            MemoryStream ms = new MemoryStream();

            data.Save(ms);
            SaveData.Data     = ms.ToArray();
            SaveData.LoadType = type;
            new RuntimeForm().Show();
        }
Esempio n. 6
0
        public override ICollection Deserialize(SerializationStore store)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            WorkflowMarkupSerializationStore xomlStore = store as WorkflowMarkupSerializationStore;

            if (xomlStore == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.Error_UnknownSerializationStore));
            }
            return((ICollection)xomlStore.Deserialize(this.serviceProvider));
        }
Esempio n. 7
0
 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);
             }
         }
     }
 }
                public override void Undo(UndoEngine engine)
                {
                    if (this._before != null)
                    {
                        IDesignerHost service = engine.GetService(typeof(IDesignerHost)) as IDesignerHost;
                        if (service != null)
                        {
                            engine._serializationService.DeserializeTo(this._before, service.Container);
                        }
                    }
                    SerializationStore store = this._after;

                    this._after  = this._before;
                    this._before = store;
                }
Esempio n. 9
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;
				}
        /// <summary>
        /// Serializes a collection of objects and stores them in a
        /// serialization data object.
        /// </summary>
        public object Serialize(ICollection objects)
        {
            if (objects == null)
            {
                throw new ArgumentNullException("objects");
            }
            ComponentSerializationService serializationService = (ComponentSerializationService)serviceProvider.GetService(typeof(ComponentSerializationService));
            SerializationStore            store = serializationService.CreateStore();

            foreach (object value in objects)
            {
                serializationService.Serialize(store, value);
            }
            store.Close();
            return(store);
        }
Esempio n. 11
0
 public static ICollection CopyDragObjects(ICollection objects, IServiceProvider svcProvider)
 {
     if ((objects != null) && (svcProvider != null))
     {
         Cursor current = Cursor.Current;
         try
         {
             Cursor.Current = Cursors.WaitCursor;
             ComponentSerializationService service = svcProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;
             IDesignerHost host = svcProvider.GetService(typeof(IDesignerHost)) as IDesignerHost;
             if ((service != null) && (host != null))
             {
                 SerializationStore store = null;
                 store = service.CreateStore();
                 foreach (IComponent component in GetCopySelection(objects, host))
                 {
                     service.Serialize(store, component);
                 }
                 store.Close();
                 ICollection is2  = service.Deserialize(store);
                 ArrayList   list = new ArrayList(objects.Count);
                 foreach (IComponent component2 in is2)
                 {
                     Control control = component2 as Control;
                     if ((control != null) && (control.Parent == null))
                     {
                         list.Add(component2);
                     }
                     else if (control == null)
                     {
                         ToolStripItem item = component2 as ToolStripItem;
                         if ((item != null) && (item.GetCurrentParent() == null))
                         {
                             list.Add(component2);
                         }
                     }
                 }
                 return(list);
             }
         }
         finally
         {
             Cursor.Current = current;
         }
     }
     return(null);
 }
Esempio n. 12
0
        public object Serialize(ICollection objects)
        {
            ComponentSerializationService componentSerializationService = this.serviceProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;
            SerializationStore            result = null;

            using (SerializationStore serializationStore = componentSerializationService.CreateStore())
            {
                foreach (object obj in objects)
                {
                    if (obj is Control)
                    {
                        componentSerializationService.Serialize(serializationStore, obj);
                    }
                }
                result = serializationStore;
            }
            return(result);
        }
Esempio n. 13
0
        public override ICollection Deserialize(SerializationStore store, IContainer container)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            WorkflowMarkupSerializationStore store2 = store as WorkflowMarkupSerializationStore;

            if (store2 == null)
            {
                throw new InvalidOperationException(SR.GetString("Error_UnknownSerializationStore"));
            }
            return(store2.Deserialize(this.serviceProvider, container));
        }
Esempio n. 14
0
        public override void DeserializeTo(SerializationStore store, IContainer container, bool validateRecycledTypes, bool applyDefaults)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            WorkflowMarkupSerializationStore store2 = store as WorkflowMarkupSerializationStore;

            if (store2 == null)
            {
                throw new InvalidOperationException(SR.GetString("Error_UnknownSerializationStore"));
            }
            store2.DeserializeTo(this.serviceProvider, container);
        }
Esempio n. 15
0
        public override void Serialize(SerializationStore store, object value)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            WorkflowMarkupSerializationStore xomlStore = store as WorkflowMarkupSerializationStore;

            if (xomlStore == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.Error_UnknownSerializationStore));
            }
            xomlStore.AddObject(value);
        }
Esempio n. 16
0
				// Reminder: _component might no longer be a valid instance
				// so one should request a new one.
				// 
				public override void Undo (UndoEngine engine)
				{
					if (_beforeChange == null) {
						// Console.WriteLine ("ComponentChangeAction.Undo: ERROR: UndoUnit is not complete.");
						return;
					}

					// Console.WriteLine ("ComponentChangeAction.Undo (" + _componentName + "." + _member.Name + ")");
					IDesignerHost host = (IDesignerHost)engine.GetRequiredService (typeof(IDesignerHost));
					_component = host.Container.Components[_componentName];

					ComponentSerializationService serializationService = engine.GetRequiredService (
						typeof (ComponentSerializationService)) as ComponentSerializationService;
					serializationService.DeserializeTo (_beforeChange, host.Container);

					SerializationStore tmp = _beforeChange;
					_beforeChange = _afterChange;
					_afterChange = tmp;
				}
Esempio n. 17
0
        public object Serialize(ICollection objects)
        {
            ComponentSerializationService componentSerializationService = serviceProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;
            SerializationStore            returnObject = null;

            using (SerializationStore serializationStore = componentSerializationService.CreateStore())
            {
                foreach (object obj in objects)
                {
                    Control c = obj as Control;
                    if (c != null)
                    {
                        componentSerializationService.Serialize(serializationStore, obj);
                        serializeSubControls(componentSerializationService, serializationStore, c);
                    }
                }
                returnObject = serializationStore;
            }
            return(returnObject);
        }
        public object Serialize(ICollection objects)
        {
            ComponentSerializationService componentSerializationService = this.serviceProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;

            using (SerializationStore serializationStore = componentSerializationService.CreateStore())
            {
                foreach (object obj in objects)
                {
                    if (obj is Control)
                    {
                        ((Control)obj).Name = null;
                        ((Control)obj).Name = null;
                        ((Control)obj).Name = "";
                        ((Control)obj).Name = "fdhgh";
                        componentSerializationService.Serialize(serializationStore, obj);
                    }
                }
                return(serializationStore);
            }
        }
Esempio n. 19
0
        public override void SerializeMember(SerializationStore store, object owningObject, MemberDescriptor member)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (owningObject == null)
            {
                throw new ArgumentNullException("owningObject");
            }
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }
            WorkflowMarkupSerializationStore xomlStore = store as WorkflowMarkupSerializationStore;

            if (xomlStore == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.Error_UnknownSerializationStore));
            }
            xomlStore.AddMember(owningObject, member);
        }
                private void SaveAfterState(UndoEngine engine)
                {
                    object            component = null;
                    IReferenceService service   = engine.GetService(typeof(IReferenceService)) as IReferenceService;

                    if (service != null)
                    {
                        component = service.GetReference(this._componentName);
                    }
                    else
                    {
                        IDesignerHost host = engine.GetService(typeof(IDesignerHost)) as IDesignerHost;
                        if (host != null)
                        {
                            component = host.Container.Components[this._componentName];
                        }
                    }
                    if (component != null)
                    {
                        this._after = this.Serialize(engine, component, this._member);
                    }
                }
	public void DeserializeTo(SerializationStore store, System.ComponentModel.IContainer container) {}
	public abstract virtual void DeserializeTo(SerializationStore store, System.ComponentModel.IContainer container, bool validateRecycledTypes, bool applyDefaults) {}
	public abstract virtual void SerializeMemberAbsolute(SerializationStore store, object owningObject, System.ComponentModel.MemberDescriptor member) {}
 public virtual void DeserializeTo(SerializationStore store, System.ComponentModel.IContainer container, bool validateRecycledTypes, bool applyDefaults)
 {
 }
 public virtual System.Collections.ICollection Deserialize(SerializationStore store)
 {
 }
 public virtual void SerializeMemberAbsolute(SerializationStore store, object owningObject, System.ComponentModel.MemberDescriptor member)
 {
 }
 public virtual void SerializeAbsolute(SerializationStore store, object value)
 {
 }
	public void DeserializeTo(SerializationStore store, System.ComponentModel.IContainer container, bool validateRecycledTypes) {}
	public abstract virtual void SerializeAbsolute(SerializationStore store, object value) {}
 public void DeserializeTo(SerializationStore store, System.ComponentModel.IContainer container)
 {
 }
Esempio n. 31
0
 private void serializeSubControls(ComponentSerializationService componentSerializationService, SerializationStore serializationStore, Control c)
 {
     if (c.Controls.Count > 0)
     {
         foreach (Control c0 in c.Controls)
         {
             componentSerializationService.Serialize(serializationStore, c0);
             serializeSubControls(componentSerializationService, serializationStore, c0);
         }
     }
 }
 public void DeserializeTo(SerializationStore store, System.ComponentModel.IContainer container, bool validateRecycledTypes)
 {
 }
Esempio n. 33
0
 // error CS0534: 'System.Workflow.ComponentModel.Design.XomlComponentSerializationService' does not implement inherited abstract member 'System.ComponentModel.Design.Serialization.ComponentSerializationService.SerializeAbsolute(System.ComponentModel.Design.Serialization.SerializationStore, object)'
 public override void SerializeAbsolute(SerializationStore store, object value)
 {
     this.Serialize(store, value);
 }
	public virtual void Serialize(SerializationStore store, object value) {}
Esempio n. 35
0
 //error CS0534: 'System.Workflow.ComponentModel.Design.XomlComponentSerializationService' does not implement inherited abstract member 'System.ComponentModel.Design.Serialization.ComponentSerializationService.SerializeMemberAbsolute(System.ComponentModel.Design.Serialization.SerializationStore, object, System.ComponentModel.MemberDescriptor)'
 public override void SerializeMemberAbsolute(SerializationStore store, object owningObject, MemberDescriptor member)
 {
     this.SerializeMember(store, owningObject, member);
 }
	public abstract virtual System.Collections.ICollection Deserialize(SerializationStore store) {}
 public virtual System.Collections.ICollection Deserialize(SerializationStore store, System.ComponentModel.IContainer container)
 {
 }
	public abstract virtual System.Collections.ICollection Deserialize(SerializationStore store, System.ComponentModel.IContainer container) {}