Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

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

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/ClassShape.Serialization.cs

    r2768 r4068  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Text;
     2using System.Diagnostics;
    43using System.Drawing;
    5 using System.ComponentModel;
    64using System.Runtime.Serialization;
     5using System.Xml.Schema;
    76using System.Xml.Serialization;
    8 using System.Diagnostics;
    9 using System.Xml.Schema;
    10 namespace Netron.Diagramming.Core
    11 {
     7namespace Netron.Diagramming.Core {
     8  /// <summary>
     9  /// Complementary partial class related to (de)serialization.
     10  /// </summary>
     11  [Serializable]
     12  public partial class ClassShape : ISerializable, IXmlSerializable, IDeserializationCallback {
     13    #region Deserialization constructor
    1214    /// <summary>
    13     /// Complementary partial class related to (de)serialization.
     15    /// Deserialization constructor
    1416    /// </summary>
    15    [Serializable]
    16     public partial class ClassShape : 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 ClassShape(SerializationInfo info, StreamingContext context)
    25             : base(info, context)
    26         {
     17    /// <param name="info">The info.</param>
     18    /// <param name="context">The context.</param>
     19    protected ClassShape(SerializationInfo info, StreamingContext context)
     20      : base(info, context) {
    2721
    28            
    29             if(Tracing.BinaryDeserializationSwitch.Enabled)
    30                 Trace.WriteLine("Deserializing the fields of 'ClassShape'.");
    3122
    32             double version = info.GetDouble("ClassShapeVersion");
    33             this.Resizable = false;
    34             this.mTitle = info.GetString("Title");
    35             this.mSubTitle = info.GetString("SubTitle");
    36             sf.Trimming = StringTrimming.EllipsisCharacter;
    37             this.textMaterial = info.GetValue("TextMaterial", typeof(LabelMaterial)) as LabelMaterial;
    38             mFolders = new CollectionBase<FolderMaterial>();
    39             this.Resizable = false;
    40             this.mCollapsed = info.GetBoolean("Collapsed");
    41             this.mBodyType = (BodyType) Enum.Parse(typeof(BodyType), info.GetString("BodyType"));
    42            
    43         }
    44         #endregion
     23      if (Tracing.BinaryDeserializationSwitch.Enabled)
     24        Trace.WriteLine("Deserializing the fields of 'ClassShape'.");
    4525
    46         #region Serialization events
    47        /*
     26      double version = info.GetDouble("ClassShapeVersion");
     27      this.Resizable = false;
     28      this.mTitle = info.GetString("Title");
     29      this.mSubTitle = info.GetString("SubTitle");
     30      sf.Trimming = StringTrimming.EllipsisCharacter;
     31      this.textMaterial = info.GetValue("TextMaterial", typeof(LabelMaterial)) as LabelMaterial;
     32      mFolders = new CollectionBase<FolderMaterial>();
     33      this.Resizable = false;
     34      this.mCollapsed = info.GetBoolean("Collapsed");
     35      this.mBodyType = (BodyType)Enum.Parse(typeof(BodyType), info.GetString("BodyType"));
     36
     37    }
     38    #endregion
     39
     40    #region Serialization events
     41    /*
    4842        [OnSerializing]
    4943        void OnSerializing(StreamingContext context)
     
    5751        }
    5852        */
    59         #endregion
     53    #endregion
    6054
    61         #region Deserialization events
    62        /*
     55    #region Deserialization events
     56    /*
    6357        [OnDeserializing]
    6458        void OnDeserializing(StreamingContext context)
     
    6862        }
    6963        */
    70         [OnDeserialized]
    71         void OnDeserialized(StreamingContext context)
    72          {
    73              if(Tracing.BinaryDeserializationSwitch.Enabled)
    74                 Trace.WriteLine("...deserialization of 'ClassShape' finished");
    75            
    76              #region Loop over the children and make re-attach the events
    77             foreach(IShapeMaterial material in Children)
    78              {
    79                  //set the parent
    80                 material.Shape = this;
     64    [OnDeserialized]
     65    void OnDeserialized(StreamingContext context) {
     66      if (Tracing.BinaryDeserializationSwitch.Enabled)
     67        Trace.WriteLine("...deserialization of 'ClassShape' finished");
    8168
    82                  if(typeof(FolderMaterial).IsInstanceOfType(material))
    83                  {
    84                      (material as FolderMaterial).OnFolderChanged += new EventHandler<RectangleEventArgs>(folders_OnFolderChanged);
    85                      mFolders.Add(material as FolderMaterial);
    86                      bodyHeight += material.Rectangle.Height + 3;
    87                  }
    88                  else if(typeof(SwitchIconMaterial).IsInstanceOfType(material))
    89                  {
    90                      xicon = material as SwitchIconMaterial;
    91                      xicon.Collapsed = mCollapsed;
    92                      (material as SwitchIconMaterial).OnExpand += new EventHandler(xicon_OnExpand);
    93                      (material as SwitchIconMaterial).OnCollapse += new EventHandler(xicon_OnCollapse);
    94                  }
    95              }
    96             #endregion
     69      #region Loop over the children and make re-attach the events
     70      foreach (IShapeMaterial material in Children) {
     71        //set the parent
     72        material.Shape = this;
    9773
    98              #region Set the initial state
    99              if(mCollapsed)
    100              {
    101                  Collapse();
    102              }
    103              else
    104              {
    105                  Expand();
    106              }
    107              #endregion
     74        if (typeof(FolderMaterial).IsInstanceOfType(material)) {
     75          (material as FolderMaterial).OnFolderChanged += new EventHandler<RectangleEventArgs>(folders_OnFolderChanged);
     76          mFolders.Add(material as FolderMaterial);
     77          bodyHeight += material.Rectangle.Height + 3;
     78        } else if (typeof(SwitchIconMaterial).IsInstanceOfType(material)) {
     79          xicon = material as SwitchIconMaterial;
     80          xicon.Collapsed = mCollapsed;
     81          (material as SwitchIconMaterial).OnExpand += new EventHandler(xicon_OnExpand);
     82          (material as SwitchIconMaterial).OnCollapse += new EventHandler(xicon_OnCollapse);
     83        }
     84      }
     85      #endregion
    10886
    109              #region Update the body, this will set the bodytype for example
    110              UpdateBody();
    111              #endregion
     87      #region Set the initial state
     88      if (mCollapsed) {
     89        Collapse();
     90      } else {
     91        Expand();
     92      }
     93      #endregion
    11294
    113              #region Finally, position everything
    114              Transform(Rectangle);
    115              #endregion
    116          }
    117        
    118         #endregion
     95      #region Update the body, this will set the bodytype for example
     96      UpdateBody();
     97      #endregion
    11998
    120         #region Serialization
    121          /// <summary>
    122          /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object.
    123          /// </summary>
    124          /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param>
    125          /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param>
    126          /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
    127          public override void  GetObjectData(SerializationInfo info, StreamingContext context)
    128         {
     99      #region Finally, position everything
     100      Transform(Rectangle);
     101      #endregion
     102    }
    129103
    130           base.GetObjectData(info, context);
    131             if (Tracing.BinarySerializationSwitch.Enabled)
    132                 Trace.WriteLine("Serializing the fields of 'ClassShape'.");
     104    #endregion
    133105
    134             info.AddValue("Title", this.Title);
    135             info.AddValue("SubTitle", this.SubTitle);
    136             info.AddValue("TextMaterial", this.textMaterial, typeof(LabelMaterial));
    137             info.AddValue("Collapsed", mCollapsed);
    138             info.AddValue("BodyType", mBodyType.ToString());
    139             info.AddValue("ClassShapeVersion", classShapeVersion);
    140         }
    141         #endregion
     106    #region Serialization
     107    /// <summary>
     108    /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object.
     109    /// </summary>
     110    /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param>
     111    /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param>
     112    /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
     113    public override void GetObjectData(SerializationInfo info, StreamingContext context) {
    142114
    143         #region Xml serialization
    144         /// <summary>
    145         /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead.
    146         /// </summary>
    147         /// <returns>
    148         /// 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.
    149         /// </returns>
    150         public override XmlSchema GetSchema()
    151         {
    152             throw new NotImplementedException("The method or operation is not implemented.");
    153         }
     115      base.GetObjectData(info, context);
     116      if (Tracing.BinarySerializationSwitch.Enabled)
     117        Trace.WriteLine("Serializing the fields of 'ClassShape'.");
    154118
    155         /// <summary>
    156         /// Generates an object from its XML representation.
    157         /// </summary>
    158         /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
    159         public override void ReadXml(System.Xml.XmlReader reader)
    160         {
    161             throw new NotImplementedException("The method or operation is not implemented.");
    162         }
     119      info.AddValue("Title", this.Title);
     120      info.AddValue("SubTitle", this.SubTitle);
     121      info.AddValue("TextMaterial", this.textMaterial, typeof(LabelMaterial));
     122      info.AddValue("Collapsed", mCollapsed);
     123      info.AddValue("BodyType", mBodyType.ToString());
     124      info.AddValue("ClassShapeVersion", classShapeVersion);
     125    }
     126    #endregion
    163127
    164         /// <summary>
    165         /// Converts an object into its XML representation.
    166         /// </summary>
    167         /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param>
    168         public override void WriteXml(System.Xml.XmlWriter writer)
    169         {
    170             throw new NotImplementedException("The method or operation is not implemented.");
    171         }
    172         #endregion
     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 override XmlSchema GetSchema() {
     136      throw new NotImplementedException("The method or operation is not implemented.");
     137    }
    173138
    174         /// <summary>
    175         /// Runs when the entire object graph has been deserialized.
    176         /// </summary>
    177         /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param>
    178         public override void OnDeserialization(object sender)
    179         {
    180             base.OnDeserialization(sender);
    181            
    182             if(Tracing.BinaryDeserializationSwitch.Enabled)
    183                 Trace.WriteLine("IDeserializationCallback of 'ClassShape' called.");
    184         }
     139    /// <summary>
     140    /// Generates an object from its XML representation.
     141    /// </summary>
     142    /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
     143    public override void ReadXml(System.Xml.XmlReader reader) {
     144      throw new NotImplementedException("The method or operation is not implemented.");
    185145    }
     146
     147    /// <summary>
     148    /// Converts an object into its XML representation.
     149    /// </summary>
     150    /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param>
     151    public override void WriteXml(System.Xml.XmlWriter writer) {
     152      throw new NotImplementedException("The method or operation is not implemented.");
     153    }
     154    #endregion
     155
     156    /// <summary>
     157    /// Runs when the entire object graph has been deserialized.
     158    /// </summary>
     159    /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param>
     160    public override void OnDeserialization(object sender) {
     161      base.OnDeserialization(sender);
     162
     163      if (Tracing.BinaryDeserializationSwitch.Enabled)
     164        Trace.WriteLine("IDeserializationCallback of 'ClassShape' called.");
     165    }
     166  }
    186167}
Note: See TracChangeset for help on using the changeset viewer.