Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/GroupShape.Serialization.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/GroupShape.Serialization.cs
r2768 r4068 1 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using System.Drawing; 5 using System.ComponentModel; 2 using System.Diagnostics; 6 3 using System.Runtime.Serialization; 4 using System.Xml.Schema; 7 5 using System.Xml.Serialization; 8 using System.Diagnostics; 9 using System.Xml.Schema; 10 namespace Netron.Diagramming.Core 11 { 6 namespace Netron.Diagramming.Core { 7 /// <summary> 8 /// Complementary partial class related to (de)serialization. 9 /// </summary> 10 [Serializable] 11 public partial class GroupShape : ISerializable, IXmlSerializable, IDeserializationCallback { 12 #region Deserialization constructor 12 13 /// <summary> 13 /// Complementary partial class related to (de)serialization.14 /// Deserialization constructor 14 15 /// </summary> 15 [Serializable] 16 public partial class GroupShape : ISerializable, IXmlSerializable, IDeserializationCallback 17 { 18 #region Deserialization constructor 19 /// <summary> 20 /// Deserialization constructor 21 /// </summary> 22 /// <param name="info">The info.</param> 23 /// <param name="context">The context.</param> 24 protected GroupShape(SerializationInfo info, StreamingContext context) : base(info, context) 25 { 26 if(Tracing.BinaryDeserializationSwitch.Enabled) 27 Trace.WriteLine("Deserializing the fields of 'GroupShape'."); 16 /// <param name="info">The info.</param> 17 /// <param name="context">The context.</param> 18 protected GroupShape(SerializationInfo info, StreamingContext context) 19 : base(info, context) { 20 if (Tracing.BinaryDeserializationSwitch.Enabled) 21 Trace.WriteLine("Deserializing the fields of 'GroupShape'."); 28 22 29 30 31 mEntities = info.GetValue("Entities",32 typeof(CollectionBase<IDiagramEntity>)) as33 34 35 23 double version = info.GetDouble("GroupShapeVersion"); 24 mAllowUnGroup = info.GetBoolean("CanUngroup"); 25 mEntities = info.GetValue("Entities", 26 typeof(CollectionBase<IDiagramEntity>)) as 27 CollectionBase<IDiagramEntity>; 28 } 29 #endregion 36 30 37 38 31 #region Serialization events 32 /* 39 33 [OnSerializing] 40 34 void OnSerializing(StreamingContext context) … … 47 41 Trace.WriteLine("...serialization of 'GroupShape' finished"); 48 42 } 49 */ 50 43 */ 44 #endregion 51 45 52 53 46 #region Deserialization events 47 /* 54 48 [OnDeserializing] 55 49 void OnDeserializing(StreamingContext context) … … 59 53 } 60 54 */ 61 [OnDeserialized] 62 void OnDeserialized(StreamingContext context) 63 { 64 if (Tracing.BinaryDeserializationSwitch.Enabled) 65 Trace.WriteLine("...deserialization of 'GroupShape' finished"); 55 [OnDeserialized] 56 void OnDeserialized(StreamingContext context) { 57 if (Tracing.BinaryDeserializationSwitch.Enabled) 58 Trace.WriteLine("...deserialization of 'GroupShape' finished"); 66 59 67 68 60 foreach (IDiagramEntity entity in mEntities) 61 entity.Group = this; 69 62 70 //this.mEntities.OnItemAdded += new EventHandler<CollectionEventArgs<IDiagramEntity>>(mEntities_OnItemAdded); 71 //this.mEntities.OnClear += new EventHandler(mEntities_OnClear); 72 //this.mEntities.OnItemRemoved += new EventHandler<CollectionEventArgs<IDiagramEntity>>(mEntities_OnItemRemoved); 73 AttachEventsToEnityCollection(mEntities); 74 CalculateRectangle(); 75 } 76 77 #endregion 63 //this.mEntities.OnItemAdded += new EventHandler<CollectionEventArgs<IDiagramEntity>>(mEntities_OnItemAdded); 64 //this.mEntities.OnClear += new EventHandler(mEntities_OnClear); 65 //this.mEntities.OnItemRemoved += new EventHandler<CollectionEventArgs<IDiagramEntity>>(mEntities_OnItemRemoved); 66 AttachEventsToEnityCollection(mEntities); 67 CalculateRectangle(); 68 } 78 69 79 #region Serialization 80 /// <summary> 81 /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object. 82 /// </summary> 83 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param> 84 /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param> 85 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> 86 public override void GetObjectData(SerializationInfo info, StreamingContext context) 87 { 88 if(Tracing.BinarySerializationSwitch.Enabled) 89 Trace.WriteLine("Serializing the fields of 'GroupShape'."); 90 base.GetObjectData(info, context); 70 #endregion 91 71 92 info.AddValue("GroupShapeVersion", groupShapeVersion); 93 info.AddValue("CanUngroup", mAllowUnGroup); 94 info.AddValue("Entities", this.mEntities, typeof(CollectionBase<IShapeMaterial>)); 95 96 } 97 #endregion 72 #region Serialization 73 /// <summary> 74 /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object. 75 /// </summary> 76 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param> 77 /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param> 78 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> 79 public override void GetObjectData(SerializationInfo info, StreamingContext context) { 80 if (Tracing.BinarySerializationSwitch.Enabled) 81 Trace.WriteLine("Serializing the fields of 'GroupShape'."); 82 base.GetObjectData(info, context); 98 83 99 #region Xml serialization 100 /// <summary> 101 /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead. 102 /// </summary> 103 /// <returns> 104 /// An <see cref="T:System.Xml.Schema.XmlSchema"></see> that describes the XML representation of the object that is produced by the <see cref="M:System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)"></see> method and consumed by the <see cref="M:System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)"></see> method. 105 /// </returns> 106 public override XmlSchema GetSchema() 107 { 108 throw new NotImplementedException("The method or operation is not implemented."); 109 } 84 info.AddValue("GroupShapeVersion", groupShapeVersion); 85 info.AddValue("CanUngroup", mAllowUnGroup); 86 info.AddValue("Entities", this.mEntities, typeof(CollectionBase<IShapeMaterial>)); 110 87 111 /// <summary> 112 /// Generates an object from its XML representation. 113 /// </summary> 114 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param> 115 public override void ReadXml(System.Xml.XmlReader reader) 116 { 117 throw new NotImplementedException("The method or operation is not implemented."); 118 } 88 } 89 #endregion 119 90 120 /// <summary> 121 /// Converts an object into its XML representation. 122 /// </summary> 123 /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param> 124 public override void WriteXml(System.Xml.XmlWriter writer) 125 { 126 throw new NotImplementedException("The method or operation is not implemented."); 127 } 128 #endregion 91 #region Xml serialization 92 /// <summary> 93 /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead. 94 /// </summary> 95 /// <returns> 96 /// An <see cref="T:System.Xml.Schema.XmlSchema"></see> that describes the XML representation of the object that is produced by the <see cref="M:System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)"></see> method and consumed by the <see cref="M:System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)"></see> method. 97 /// </returns> 98 public override XmlSchema GetSchema() { 99 throw new NotImplementedException("The method or operation is not implemented."); 100 } 129 101 130 #region IDeserializationCallback Members 102 /// <summary> 103 /// Generates an object from its XML representation. 104 /// </summary> 105 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param> 106 public override void ReadXml(System.Xml.XmlReader reader) { 107 throw new NotImplementedException("The method or operation is not implemented."); 108 } 131 109 132 133 /// Runs when the entire object graph has been deserialized.134 135 /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param>136 public override void OnDeserialization(object sender)137 {138 base.OnDeserialization(sender);139 110 /// <summary> 111 /// Converts an object into its XML representation. 112 /// </summary> 113 /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param> 114 public override void WriteXml(System.Xml.XmlWriter writer) { 115 throw new NotImplementedException("The method or operation is not implemented."); 116 } 117 #endregion 140 118 141 if(Tracing.BinaryDeserializationSwitch.Enabled) 142 Trace.WriteLine("IDeserializationCallback of 'GroupShape' called."); 143 } 119 #region IDeserializationCallback Members 144 120 145 #endregion 121 /// <summary> 122 /// Runs when the entire object graph has been deserialized. 123 /// </summary> 124 /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param> 125 public override void OnDeserialization(object sender) { 126 base.OnDeserialization(sender); 127 128 129 if (Tracing.BinaryDeserializationSwitch.Enabled) 130 Trace.WriteLine("IDeserializationCallback of 'GroupShape' called."); 146 131 } 132 133 #endregion 134 } 147 135 }
Note: See TracChangeset
for help on using the changeset viewer.