示例#1
0
        /// <summary>
        /// Initialise l'instance depuis les données d'un flux binaire
        /// </summary>
        /// <param name="reader">Flux binaire</param>
        /// <param name="aggregationCallback">Permet d'appliquer des modifications aux entités importées par aggrégation</param>
        /// <remarks>Seuls les éléments existants dans le noeud Xml son importés dans l'objet</remarks>
        public void ReadBinary(BinaryReader reader, EntityCallback aggregationCallback)
        {
            // Properties
            Version = reader.ReadString();
            SelectedDatabaseSourceId = reader.ReadString();

            // EditorSampleCode
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    //this.EditorSampleCode = new Collection<EditorSampleCode>();
                    for (int i = 0; i < size; i++)
                    {
                        EditorSampleCode o = new EditorSampleCode();
                        this.Model.Add(o);
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddEditorSampleCode(o);
                    }
                }
                //else
                //{
                //    this.EditorSampleCode = new Collection<EditorSampleCode>();
                //}
            }
        }
示例#2
0
        /// <summary>
        /// Initialise l'instance depuis des données XML
        /// </summary>
        /// <param name="element">Élément contenant les information sur l'objet</param>
        /// <param name="aggregationCallback">Permet d'appliquer des modifications aux entités importées par aggrégation</param>
        /// <remarks>Seuls les éléments existants dans le noeud Xml son importés dans l'objet</remarks>
        public void FromXml(XmlElement element, EntityCallback aggregationCallback)
        {
            foreach (XmlElement m in element.ChildNodes)
            {
                string property_value = m.InnerText.Trim();
                // charge les paramètres
                switch (m.Name)
                {
                //
                // Fields
                //

                // Assigne le membre Version
                case "Version":
                {
                    this.version = property_value;
                }
                break;

                // Assigne le membre SelectedDatabaseSourceId
                case "SelectedDatabaseSourceId":
                {
                    this.selecteddatabasesourceid = property_value;
                }
                break;

                //
                // Compositions
                //

                // Assigne la collection EditorSampleCode
                case "EditorSampleCode":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("EditorSampleCode" == c.Name)
                        {
                            EditorSampleCode value = new EditorSampleCode();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddEditorSampleCode(value);
                        }
                    }
                }
                break;
                }
            }
        }
示例#3
0
        // copie
        public IEntity Copy(IEntity _dst, IEntity _src)
        {
            EditorSampleCode src = _src as EditorSampleCode;
            EditorSampleCode dst = _dst as EditorSampleCode;

            if (src == null || dst == null)
            {
                return(null);
            }

            // Text
            dst.text = src.text;
            // ObjectSyntaxType
            dst.objectsyntaxtype = src.objectsyntaxtype;
            return(dst);
        }
示例#4
0
 public void RemoveEditorSampleCode(EditorSampleCode obj)
 {
     obj.Model.Remove(obj);
     obj.EditorStates = null;
     obj.Model        = null;
 }
示例#5
0
 public void AddEditorSampleCode(EditorSampleCode obj)
 {
     this.Model.Add(obj);
     obj.EditorStates = this;
     obj.Model        = this.Model;//assure l'initialisation (normalement par this.Model.Add)
 }
示例#6
0
 // copie
 public EditorSampleCode(EditorSampleCode src) : this()
 {
     Copy(this, src);
 }