示例#1
0
文件: Page.cs 项目: suntabu/axiom
        public virtual PageContentCollection CreateContentCollection(string typeName)
        {
            PageContentCollection coll = Manager.CreateContentCollection(typeName);

            coll.NotifyAttached(this);
            this.mContentCollections.Add(coll);
            return(coll);
        }
示例#2
0
文件: Page.cs 项目: suntabu/axiom
        public virtual void DestroyContentCollection(ref PageContentCollection coll)
        {
            if (this.mContentCollections.Contains(coll))
            {
                this.mContentCollections.Remove(coll);
            }

            Manager.DestroyContentCollection(ref coll);
        }
示例#3
0
文件: Page.cs 项目: suntabu/axiom
        protected virtual bool PrepareImpl(StreamSerializer stream, ref PageData dataToPopulate)
        {
            //now do the real loading
            if (stream.ReadChunkBegin(CHUNK_ID, CHUNK_VERSION, "Page") == null)
            {
                return(false);
            }

            // pageID check (we should know the ID we're expecting)
            int storedID = -1;

            stream.Read(out storedID);
            if (this.mID.Value != storedID)
            {
                LogManager.Instance.Write("Error: Tried to populate Page ID {0} with data corresponding to page ID {1}",
                                          this.mID.Value,
                                          storedID);
                stream.UndoReadChunk(CHUNK_ID);
                return(false);
            }

            PageManager mgr = Manager;

            while (stream.NextChunkId == Page.CHUNK_CONTENTCOLLECTION_DECLARATION_ID)
            {
                Chunk  collChunk = stream.ReadChunkBegin();
                string factoryName;
                stream.Read(out factoryName);
                stream.ReadChunkEnd(CHUNK_CONTENTCOLLECTION_DECLARATION_ID);
                //Supported type?
                IPageContentCollectionFactory collFact = mgr.GetContentCollectionFactory(factoryName);
                if (collFact != null)
                {
                    PageContentCollection collInst = collFact.CreateInstance();
                    if (collInst.Prepare(stream))
                    {
                        dataToPopulate.collectionsToAdd.Add(collInst);
                    }
                    else
                    {
                        LogManager.Instance.Write("Error preparing PageContentCollection type: {0} in {1}", factoryName, ToString());
                        collFact.DestroyInstance(ref collInst);
                    }
                }
                else
                {
                    LogManager.Instance.Write("Unsupported PageContentCollection type: {0} in {1}", factoryName, ToString());
                    //skip
                    stream.ReadChunkEnd(collChunk.id);
                }
            }

            this.mModified = false;
            return(true);
        }
示例#4
0
        public void DestroyContentCollection(ref PageContentCollection coll)
        {
            IPageContentCollectionFactory fact = GetContentCollectionFactory(coll.Type);

            if (fact != null)
            {
                fact.DestroyInstance(ref coll);
            }
            else
            {
                coll.SafeDispose();                 //normally a safe fallback
            }
        }
示例#5
0
 internal virtual void NotifyAttached(PageContentCollection parent)
 {
     this.mParent = parent;
 }
		public void DestroyInstance( ref PageContentCollection c )
		{
			c.SafeDispose();
		}
示例#7
0
文件: Page.cs 项目: WolfgangSt/axiom
 /// <summary>
 /// 
 /// </summary>
 /// <param name="coll"></param>
 public virtual void DetachContentCollection(PageContentCollection coll)
 {
     bool found = false;
     foreach (PageContentCollection i in mContentCollections)
     {
         if (coll == i)
         {
             coll.NotifyAttached(null);
             found = true;
         }
     }
     if (found)
         mContentCollections.Remove(coll);
 }
示例#8
0
文件: Page.cs 项目: WolfgangSt/axiom
 /// <summary>
 /// Add a content collection to this Page. 
 /// </summary>
 /// <remarks>This class ceases to be responsible for deleting this collection.</remarks>
 /// <param name="coll"></param>
 public virtual void AttachContentCollection(PageContentCollection coll)
 {
     coll.NotifyAttached(this);
     mContentCollections.Add(coll);
 }
示例#9
0
文件: Page.cs 项目: WolfgangSt/axiom
        /// <summary>
        /// Destroy a PageContentCollection within this page.
		/// This is equivalent to calling DetachContentCollection and 
		///	PageManager.DestroyContentCollection.
        /// </summary>
        /// <param name="coll"></param>
        public virtual void DestroyContentCollection(PageContentCollection coll)
        {
            DetachContentCollection(coll);
            Manager.DestroyContentenCollection(coll);
        }
示例#10
0
		public virtual void DestroyContentCollection( ref PageContentCollection coll )
		{
			if ( this.mContentCollections.Contains( coll ) )
			{
				this.mContentCollections.Remove( coll );
			}

			Manager.DestroyContentCollection( ref coll );
		}
 public void DestroyInstance(ref PageContentCollection c)
 {
     c.SafeDispose();
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="c"></param>
 public void DestroyInstance(ref PageContentCollection c)
 {
     c = null;
 }
示例#13
0
 /// <summary>
 /// Internal method to notify a page that it is attached
 /// </summary>
 /// <param name="parent"></param>
 public virtual void NotifyAttached(PageContentCollection parent)
 {
     mParent = parent;
 }
示例#14
0
		public void DestroyContentCollection( ref PageContentCollection coll )
		{
			IPageContentCollectionFactory fact = GetContentCollectionFactory( coll.Type );
			if ( fact != null )
			{
				fact.DestroyInstance( ref coll );
			}
			else
			{
				coll.SafeDispose(); //normally a safe fallback
			}
		}
示例#15
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="coll"></param>
 public void DestroyContentenCollection(PageContentCollection coll)
 {
     IPageContentCollectionFactory fact = GetContentCollectionFactory(coll.Type);
     if (fact != null)
         fact.DestroyInstance(ref coll);
     else
         coll = null; //normally a safe fallback
 }
示例#16
0
		internal virtual void NotifyAttached( PageContentCollection parent )
		{
			this.mParent = parent;
		}