Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2901_StaticSelectionMethods/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/Ambience.Serialization.cs @ 15778

Last change on this file since 15778 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

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