示例#1
0
        //if child was added
        void element_ChildAdded(object sender, ChildAddedEventArgs e)
        {
            var parent = sender as SvgElement;

            if (e.NewChild is SvgVisualElement)
            {
                var newChild = e.NewChild;
                if ((!newChild.ID.StartsWith(parent.ID + "_") || parent is SvgDocument) && !(parent is SvgDefinitionList))
                {
                    newChild.ApplyRecursive(elem =>
                    {
                        var oldID = elem.ID.Substring(elem.ID.LastIndexOf("_") + 1);
                        elem.SetAndForceUniqueID(elem.Parent.ID + "_" + oldID);
                        elem.RegisterEvents(FCaller);
                    });
                }
                else
                {
                    newChild.RegisterEvents(FCaller);
                }
            }

            //add to remote context
            if (e.NewChild.OwnerDocument != null)
            {
                if (e.BeforeSibling == null)
                {
                    RemoteContext.AddElement(e.NewChild);
                }
                else
                {
                    RemoteContext.InsertElementBefore(e.NewChild, e.BeforeSibling);
                }
            }
        }
示例#2
0
        // From Container Base class
        /// <summary>
        /// Adds a child view to this view.
        /// </summary>
        /// <seealso cref="Container.Add" />
        /// <since_tizen> 4 </since_tizen>
        public override void Add(View child)
        {
            bool hasLayout = (layout != null);

            if (null == child)
            {
                Tizen.Log.Fatal("NUI", "Child is null");
                return;
            }

            Container oldParent = child.GetParent();

            if (oldParent != this)
            {
                // If child already has a parent then re-parent child
                if (oldParent != null)
                {
                    if (child.Layout != null)
                    {
                        child.Layout.SetReplaceFlag();
                    }
                    oldParent.Remove(child);
                }
                child.InternalParent = this;
                LayoutCount         += child.LayoutCount;

                Interop.Actor.Add(SwigCPtr, View.getCPtr(child));

                if (NDalicPINVOKE.SWIGPendingException.Pending)
                {
                    throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                }
                Children.Add(child);

                if (ChildAdded != null)
                {
                    ChildAddedEventArgs e = new ChildAddedEventArgs
                    {
                        Added = child
                    };
                    ChildAdded(this, e);
                }

                AddChildBindableObject(child);
            }
        }
        void OnChildAddedToRepository(object sender, ChildAddedEventArgs e)
        {
            var viewModel = new ChildViewModel(e.NewChild, _childRepository);

            this.AllChilds.Add(viewModel);
        }
示例#4
0
文件: SvgIdManager.cs 项目: vvvv/Posh
        //if child was added
        void element_ChildAdded(object sender, ChildAddedEventArgs e)
        {
            var parent = sender as SvgElement;
            if(e.NewChild is SvgVisualElement)
            {
                var newChild = e.NewChild;
                if((!newChild.ID.StartsWith(parent.ID + "_") || parent is SvgDocument) && !(parent is SvgDefinitionList))
                {
                    newChild.ApplyRecursive( elem =>
                                            {
                                                var oldID = elem.ID.Substring(elem.ID.LastIndexOf("_") + 1);
                                                elem.SetAndForceUniqueID(elem.Parent.ID + "_" + oldID);
                                                elem.RegisterEvents(FCaller);
                                            });
                }
                else
                {
                    newChild.RegisterEvents(FCaller);
                }
            }

            //add to remote context
            if(e.NewChild.OwnerDocument != null)
            {
                if(e.BeforeSibling == null)
                {
                    RemoteContext.AddElement(e.NewChild);
                }
                else
                {
                    RemoteContext.InsertElementBefore(e.NewChild, e.BeforeSibling);
                }
            }
        }
示例#5
0
        public override void CallEvent(FirebaseException firebaseException)
        {
            var childAddedEventArgs = new ChildAddedEventArgs(firebaseException);

            @event(childAddedEventArgs);
        }
示例#6
0
        public override void CallEvent(Snapshot snapshot)
        {
            var childAddedEventArgs = new ChildAddedEventArgs(snapshot);

            @event(childAddedEventArgs);
        }