Beispiel #1
0
        public void AttachLWF(LWF attachLWF, string attachName,
                              int attachDepth             = -1, bool reorder = false,
                              DetachHandler detachHandler = null)
        {
            if (m_attachedLWFs == null)
            {
                m_attachedLWFs              = new AttachedLWFs();
                m_detachedLWFs              = new DetachDict();
                m_attachedLWFList           = new AttachedLWFList();
                m_attachedLWFDescendingList =
                    new AttachedLWFDescendingList(new DescendingComparer <int>());
            }

            LWFContainer lwfContainer;

            if (attachLWF.parent != null)
            {
                attachLWF.parent.m_attachedLWFs.TryGetValue(
                    attachLWF.attachName, out lwfContainer);
                DeleteAttachedLWF(attachLWF.parent, lwfContainer, false);
            }
            else
            {
                if (m_attachedLWFs.TryGetValue(attachName, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            if (!reorder && attachDepth >= 0)
            {
                if (m_attachedLWFList.TryGetValue(attachDepth, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            lwfContainer = new LWFContainer(this, attachLWF);

            if (attachLWF.interactive == true)
            {
                m_lwf.interactive = true;
            }
            attachLWF.parent        = this;
            attachLWF.detachHandler = detachHandler;
            attachLWF.attachName    = attachName;
            attachLWF.depth         = attachDepth >= 0 ? attachDepth :
                                      m_attachedLWFDescendingList.Keys.GetEnumerator().Current + 1;
            m_attachedLWFs[attachName] = lwfContainer;
            ReorderAttachedLWFList(reorder, attachLWF.depth, lwfContainer);

            m_lwf.isLWFAttached = true;
        }
Beispiel #2
0
        public void AttachLWF(LWF attachLWF, string attachName,
                              int attachDepth             = -1, bool reorder = false,
                              DetachHandler detachHandler = null)
        {
            if (m_attachedLWFs == null)
            {
                m_attachedLWFs    = new AttachedLWFs();
                m_detachedLWFs    = new DetachDict();
                m_attachedLWFList = new AttachedLWFList();
            }

            LWFContainer lwfContainer;

            if (attachLWF.parent != null)
            {
                attachLWF.parent.m_attachedLWFs.TryGetValue(
                    attachLWF.attachName, out lwfContainer);
                DeleteAttachedLWF(attachLWF.parent, lwfContainer, false);
            }
            else
            {
                if (m_attachedLWFs.TryGetValue(attachName, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            if (!reorder && attachDepth >= 0 &&
                attachDepth <= m_attachedLWFList.Count - 1)
            {
                lwfContainer = m_attachedLWFList[attachDepth];
                if (lwfContainer != null)
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            lwfContainer = new LWFContainer(this, attachLWF);

            if (attachLWF.interactive == true)
            {
                m_lwf.interactive = true;
            }
            attachLWF.parent        = this;
            attachLWF.detachHandler = detachHandler;
            attachLWF.attachName    = attachName;
            attachLWF.depth         = attachDepth >= 0 ?
                                      attachDepth : m_attachedLWFList.Count;
            m_attachedLWFs[attachName] = lwfContainer;
            ReorderAttachedLWFList(reorder, attachLWF.depth, lwfContainer);

            m_lwf.isLWFAttached = true;
        }
Beispiel #3
0
        public void AttachLWF(LWF child, string attachName, int attachDepth = -1,
                              bool reorder = false, DetachHandler detachHandler = null)
        {
            if (m_attachedLWFs == null)
            {
                m_attachedLWFs              = new AttachedLWFs();
                m_detachedLWFs              = new DetachDict();
                m_attachedLWFList           = new AttachedLWFList();
                m_attachedLWFDescendingList =
                    new AttachedLWFDescendingList(new DescendingComparer <int>());
            }

            LWFContainer lwfContainer;

            if (child.parent != null)
            {
                child.parent.m_attachedLWFs.TryGetValue(
                    child.attachName, out lwfContainer);
                DeleteAttachedLWF(child.parent, lwfContainer, false);
            }
            if (m_attachedLWFs.TryGetValue(attachName, out lwfContainer))
            {
                DeleteAttachedLWF(this, lwfContainer);
            }

            if (!reorder && attachDepth >= 0)
            {
                if (m_attachedLWFList.TryGetValue(attachDepth, out lwfContainer))
                {
                    DeleteAttachedLWF(this, lwfContainer);
                }
            }

            lwfContainer = new LWFContainer(this, child);

            if (child.interactive == true)
            {
                m_lwf.SetInteractive();
            }
            child.parent        = this;
            child.detachHandler = detachHandler;
            child.attachName    = attachName;
            if (attachDepth >= 0)
            {
                child.depth = attachDepth;
            }
            else
            {
                AttachedLWFDescendingList.KeyCollection.Enumerator e =
                    m_attachedLWFDescendingList.Keys.GetEnumerator();
                if (e.MoveNext())
                {
                    child.depth = e.Current + 1;
                }
                else
                {
                    child.depth = 0;
                }
            }
            m_attachedLWFs[attachName] = lwfContainer;
            ReorderAttachedLWFList(reorder, child.depth, lwfContainer);

            m_lwf.SetLWFAttached();

            return;
        }