Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/Ambience.Serialization.cs @ 2768

Last change on this file since 2768 was 2768, checked in by mkommend, 14 years ago

added solution folders and sources for the netron library (ticket #867)

File size: 6.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Drawing;
5using System.ComponentModel;
6using System.Runtime.Serialization;
7using System.Xml.Serialization;
8using System.Diagnostics;
9using System.Xml.Schema;
10namespace Netron.Diagramming.Core
11{
12    /// <summary>
13    /// Complementary partial class related to (de)serialization.
14    /// </summary>
15    [Serializable]
16    public partial class Ambience : ISerializable, IXmlSerializable, IDeserializationCallback
17    {
18        //about xml serialization of color
19        //http://dotnetified.com/PermaLink.aspx?guid=E86B447E-AA95-49B6-909F-CDA36ACF481F
20
21        #region Deserialization constructor
22        /// <summary>
23        /// Deserialization constructor
24        /// </summary>
25        /// <param name="info">The info.</param>
26        /// <param name="context">The context.</param>
27        protected Ambience(SerializationInfo info, StreamingContext context)
28        {
29            if(Tracing.BinaryDeserializationSwitch.Enabled)
30                Trace.WriteLine("Deserializing the fields of 'Ambience'.");
31
32            double version = info.GetDouble("AmbienceVersion");
33            this.BackgroundColor = (Color)info.GetValue("BackgroundColor", typeof(Color));
34            this.PageColor = (Color)info.GetValue("PageBackgroundColor", typeof(Color));
35        }
36        #endregion
37
38        #region Serialization events
39        /*
40        [OnSerializing]
41        void OnSerializing(StreamingContext context)
42        {
43            Trace.Indent();
44            Trace.WriteLine("Starting to serializing the 'Ambience' class...");
45        }
46        [OnSerialized]
47        void OnSerialized(StreamingContext context)
48        {
49            Trace.WriteLine("...serialization of 'Ambience' finished");
50            Trace.Unindent();
51        }
52        */
53        #endregion
54
55        #region Deserialization events
56        /*
57        [OnDeserializing]
58        void OnDeserializing(StreamingContext context)
59        {
60            Trace.Indent();
61            Trace.WriteLine("Starting deserializing the 'Ambience' class...");
62        }
63        [OnDeserialized]
64        void OnDeserialized(StreamingContext context)
65         {
66             Trace.WriteLine("...deserialization of 'Ambience' finished");
67             Trace.Unindent();
68         }
69        */
70        #endregion
71
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 virtual void GetObjectData(SerializationInfo info, StreamingContext context)
80        {
81            if(Tracing.BinarySerializationSwitch.Enabled)
82                Trace.WriteLine("Serializing the fields of 'Ambience'.");
83
84            info.AddValue("AmbienceVersion", ambienceVersion);
85
86            info.AddValue(
87                "BackgroundColor",
88                this.BackgroundColor,
89                typeof(Color));
90
91            info.AddValue(
92                "BackgroundType",
93                BackgroundType,
94                typeof(CanvasBackgroundTypes));
95
96            info.AddValue(
97                "BackgroundGradientColor1",
98                this.BackgroundGradientColor1,
99                typeof(Color));
100
101            info.AddValue(
102                "BackgroundGradientColor2",
103                this.BackgroundGradientColor2,
104                typeof(Color));
105
106            info.AddValue(
107                "PageBackgroundColor",
108                this.PageColor,
109                typeof(Color));
110
111            info.AddValue(
112                "PageBackgroundType",
113                PageBackgroundType,
114                typeof(CanvasBackgroundTypes));
115
116            info.AddValue(
117                "PageBackgroundGradientColor1",
118                this.PageGradientColor1,
119                typeof(Color));
120
121            info.AddValue(
122                "PageBackgroundGradientColor2",
123                this.PageGradientColor2,
124                typeof(Color));
125        }
126        #endregion
127
128        #region Xml serialization
129        /// <summary>
130        /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead.
131        /// </summary>
132        /// <returns>
133        /// 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.
134        /// </returns>
135        public XmlSchema GetSchema()
136        {
137            throw new NotImplementedException("The method or operation is not implemented.");
138        }
139
140        /// <summary>
141        /// Generates an object from its XML representation.
142        /// </summary>
143        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
144        public void ReadXml(System.Xml.XmlReader reader)
145        {
146            throw new NotImplementedException("The method or operation is not implemented.");
147        }
148
149        /// <summary>
150        /// Converts an object into its XML representation.
151        /// </summary>
152        /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param>
153        public void WriteXml(System.Xml.XmlWriter writer)
154        {
155            throw new NotImplementedException("The method or operation is not implemented.");
156        }
157        #endregion
158
159        #region IDeserializationCallback Members
160
161        /// <summary>
162        /// Runs when the entire object graph has been deserialized.
163        /// </summary>
164        /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param>
165        public void OnDeserialization(object sender)
166        {
167            if(Tracing.BinaryDeserializationSwitch.Enabled)
168                Trace.WriteLine("IDeserializationCallback of 'Ambience' called.");
169        }
170       
171        #endregion
172    }
173}
Note: See TracBrowser for help on using the repository browser.