Ejemplo n.º 1
0
            public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                DocNodeProxy s = (DocNodeProxy)obj;

                if (s._docNode is Main.IDocumentNode)
                {
                    info.AddValue("Node", Main.DocumentPath.GetAbsolutePath((Main.IDocumentNode)s._docNode));
                }
                else if (s._docNodePath != null)
                {
                    info.AddValue("Node", s._docNodePath);
                }
                else
                {
                    info.AddValue("Node", s._docNode);
                }
            }
Ejemplo n.º 2
0
 /// <summary>
 /// Cloning constructor.
 /// </summary>
 /// <param name="from">Object to clone from.</param>
 public DocNodeProxy(DocNodeProxy from)
 {
     if (from._docNode is Main.IDocumentNode)
     {
         this.SetDocNode(from._docNode); // than the new Proxy refers to the same document node
     }
     else if (from._docNode is ICloneable)
     {
         this.SetDocNode(((System.ICloneable)from._docNode).Clone()); // clone the underlying object
     }
     else if (from._docNode != null)
     {
         this.SetDocNode(from._docNode); // the underlying object is not cloneable, so refer directly to it
     }
     else if (from._docNodePath != null)
     {
         this._docNodePath = from._docNodePath.Clone(); // if no current document available, clone only the path
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Cloning constructor.
        /// </summary>
        /// <param name="from">Object to clone from.</param>
        public DocNodeProxy(DocNodeProxy from)
        {
            if (null == from)
            {
                throw new ArgumentNullException(nameof(from));
            }
            if (from.IsDisposeInProgress)
            {
                throw new ObjectDisposedException(nameof(from));
            }

            if (null != from.InternalDocumentNode)
            {
                SetDocNode(from.InternalDocumentNode); // than the new Proxy refers to the same document node
            }
            else
            {
                InternalDocumentPath = from._docNodePath.Clone(); // if no current document available, clone only the path
                InternalCheckAbsolutePath();
            }
        }
Ejemplo n.º 4
0
            public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                DocNodeProxy s = null != o ?(DocNodeProxy)o : new DocNodeProxy();

                object node = info.GetValue("Node", typeof(object));

                if (node is Main.DocumentPath)
                {
                    s._docNodePath = (Main.DocumentPath)node;
                }
                else
                {
                    s.SetDocNode(node);
                }

                // create a callback to resolve the instance as early as possible
                if (s._docNodePath != null && s._docNode == null)
                {
                    info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(s.EhXmlDeserializationFinished);
                }


                return(s);
            }
Ejemplo n.º 5
0
		/// <summary>
		/// Cloning constructor.
		/// </summary>
		/// <param name="from">Object to clone from.</param>
		public DocNodeProxy(DocNodeProxy from)
		{
			if (null == from)
				throw new ArgumentNullException(nameof(from));
			if (from.IsDisposeInProgress)
				throw new ObjectDisposedException(nameof(from));

			if (null != from.InternalDocumentNode)
			{
				this.SetDocNode(from.InternalDocumentNode); // than the new Proxy refers to the same document node
			}
			else
			{
				this.InternalDocumentPath = from._docNodePath.Clone(); // if no current document available, clone only the path
				InternalCheckAbsolutePath();
			}
		}
Ejemplo n.º 6
0
 /// <summary>
 /// Cloning constructor.
 /// </summary>
 /// <param name="from">Object to clone from.</param>
 public DocNodeProxy(DocNodeProxy from)
 {
   if (from._docNode is Main.IDocumentNode)
     this.SetDocNode(from._docNode); // than the new Proxy refers to the same document node
   else if (from._docNode is ICloneable)
     this.SetDocNode(((System.ICloneable)from._docNode).Clone()); // clone the underlying object
   else if (from._docNode != null)
     this.SetDocNode(from._docNode); // the underlying object is not cloneable, so refer directly to it
   else if(from._docNodePath != null)
     this._docNodePath= from._docNodePath.Clone(); // if no current document available, clone only the path
 }