Пример #1
0
        private void OnSize2DChanged(int?width, int?height)
        {
            PropertyValue temp;

            if (width != null)
            {
                temp = new Tizen.NUI.PropertyValue((float)width);
                Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeWidth, temp);
                temp.Dispose();
            }
            if (height != null)
            {
                temp = new Tizen.NUI.PropertyValue((float)height);
                Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeHeight, temp);
                temp.Dispose();
            }
        }
Пример #2
0
        internal Layer GetBorderWindowRootLayer()
        {
            if (borderWindowRootLayer == null)
            {
                borderWindowRootLayer      = new Layer();
                borderWindowRootLayer.Name = "RootLayer";
                using Vector3 topCentor    = new Vector3(0.5f, 0.0f, 0.5f);
                Interop.ActorInternal.SetParentOrigin(borderWindowRootLayer.SwigCPtr, topCentor.SwigCPtr);
                Interop.Actor.SetAnchorPoint(borderWindowRootLayer.SwigCPtr, topCentor.SwigCPtr);
                Interop.Actor.Add(rootLayer.SwigCPtr, borderWindowRootLayer.SwigCPtr);
                Interop.ActorInternal.SetSize(borderWindowRootLayer.SwigCPtr, WindowSize.Width, WindowSize.Height - borderHeight - borderInterface.BorderLineThickness * 2);
                float height = (isTop == true) ? topView.SizeHeight : 0;
                Interop.ActorInternal.SetPosition(borderWindowRootLayer.SwigCPtr, 0, height + borderInterface.BorderLineThickness);
                using PropertyValue propertyValue = new Tizen.NUI.PropertyValue((int)Tizen.NUI.ClippingModeType.ClipToBoundingBox);
                Tizen.NUI.Object.SetProperty(borderWindowRootLayer.SwigCPtr, Tizen.NUI.BaseComponents.View.Property.ClippingMode, propertyValue);

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

            return(borderWindowRootLayer);
        }
Пример #3
0
        public void Push(Page page)
        {
            if (page == null)
            {
                throw new ArgumentNullException(nameof(page), "page should not be null.");
            }

            //Duplicate page is not pushed.
            if (NavigationPages.Contains(page))
            {
                return;
            }

            var curTop = Peek();

            if (!curTop)
            {
                Insert(0, page);
                return;
            }

            NavigationPages.Add(page);
            Add(page);

            //Invoke Page events
            page.InvokeAppearing();
            curTop.InvokeDisappearing();

            //TODO: The following transition codes will be replaced with view transition.
            if (_curAnimation)
            {
                _curAnimation.Stop();
                _curAnimation.Clear();
            }

            if (_newAnimation)
            {
                _newAnimation.Stop();
                _newAnimation.Clear();
            }

            _curAnimation = new Animation(1000);
            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
            {
                _curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
            }
            _curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
            _curAnimation.EndAction = Animation.EndActions.Discard;
            _curAnimation.Play();

            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
            {
                using (var scaleProp = new Tizen.NUI.PropertyValue(scaleVec))
                {
                    Tizen.NUI.Object.SetProperty(page.SwigCPtr, Page.Property.SCALE, scaleProp);
                }
            }
            using (var scaleProp = new Tizen.NUI.PropertyValue(0.0f))
            {
                Tizen.NUI.Object.SetProperty(page.SwigCPtr, Page.Property.OPACITY, scaleProp);
            }
            _newAnimation = new Animation(1000);
            using (var scaleVec = new Vector3(1.0f, 1.0f, 1.0f))
            {
                _newAnimation.AnimateTo(page, "Scale", scaleVec, 0, 1000);
            }
            _newAnimation.AnimateTo(page, "Opacity", 1.0f, 0, 1000);
            _newAnimation.Play();
        }
Пример #4
0
        public Page Pop()
        {
            if (NavigationPages.Count == 0)
            {
                throw new InvalidOperationException("There is no page in Navigator.");
            }

            var curTop = Peek();

            if (NavigationPages.Count == 1)
            {
                Remove(curTop);
                return(curTop);
            }

            var newTop = NavigationPages[NavigationPages.Count - 2];

            //Invoke Page events
            newTop.InvokeAppearing();
            curTop.InvokeDisappearing();

            //TODO: The following transition codes will be replaced with view transition.
            if (_curAnimation)
            {
                _curAnimation.Stop();
                _curAnimation.Clear();
            }

            if (_newAnimation)
            {
                _newAnimation.Stop();
                _newAnimation.Clear();
            }

            _curAnimation = new Animation(1000);
            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
            {
                _curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
            }
            _curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
            _curAnimation.Play();
            _curAnimation.Finished += (object sender, EventArgs e) =>
            {
                //Removes the current top page after transition is finished.
                Remove(curTop);
            };

            using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
            {
                using (var scaleProp = new Tizen.NUI.PropertyValue(scaleVec))
                {
                    Tizen.NUI.Object.SetProperty(newTop.SwigCPtr, Page.Property.SCALE, scaleProp);
                }
            }
            using (var opacityProp = new Tizen.NUI.PropertyValue(0.0f))
            {
                Tizen.NUI.Object.SetProperty(newTop.SwigCPtr, Page.Property.OPACITY, opacityProp);
            }
            _newAnimation = new Animation(1000);
            using (var scaleVec = new Vector3(1.0f, 1.0f, 1.0f))
            {
                _newAnimation.AnimateTo(newTop, "Scale", scaleVec, 0, 1000);
            }
            _newAnimation.AnimateTo(newTop, "Opacity", 1.0f, 0, 1000);
            _newAnimation.Play();

            return(curTop);
        }
Пример #5
0
 /// <summary>
 /// Called when the owning view property is set.
 /// </summary>
 /// <param name="index">The property index that was set.</param>
 /// <param name="propertyValue">The value to set.</param>
 /// <since_tizen> 3 </since_tizen>
 public virtual void OnPropertySet(int index, Tizen.NUI.PropertyValue propertyValue)
 {
 }
Пример #6
0
        /// <summary>
        /// Pops the top page from Navigator.
        /// </summary>
        /// <returns>The popped page.</returns>
        /// <exception cref="InvalidOperationException">Thrown when there is no page in Navigator.</exception>
        /// <since_tizen> 9 </since_tizen>
        public Page Pop()
        {
            if (!transitionFinished)
            {
                Tizen.Log.Error("NUI", "Transition is still not finished.\n");
                return(null);
            }

            if (navigationPages.Count == 0)
            {
                throw new InvalidOperationException("There is no page in Navigator.");
            }

            var curTop = Peek();

            if (navigationPages.Count == 1)
            {
                Remove(curTop);
                return(curTop);
            }

            var newTop = navigationPages[navigationPages.Count - 2];

            //Invoke Page events
            newTop.InvokeAppearing();
            curTop.InvokeDisappearing();

            //TODO: The following transition codes will be replaced with view transition.
            if (curAnimation)
            {
                curAnimation.Stop();
                curAnimation.Clear();
            }

            if (newAnimation)
            {
                newAnimation.Stop();
                newAnimation.Clear();
            }

            if (curTop is DialogPage == false)
            {
                curAnimation = new Animation(1000);
                curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
                curAnimation.Play();
                curAnimation.Finished += (object sender, EventArgs e) =>
                {
                    //Removes the current top page after transition is finished.
                    Remove(curTop);
                };

                using (var opacityProp = new Tizen.NUI.PropertyValue(0.0f))
                {
                    Tizen.NUI.Object.SetProperty(newTop.SwigCPtr, Page.Property.OPACITY, opacityProp);
                }
                newAnimation = new Animation(1000);
                newAnimation.AnimateTo(newTop, "Opacity", 1.0f, 0, 1000);
                newAnimation.Play();
            }
            else
            {
                Remove(curTop);
            }

            return(curTop);
        }
Пример #7
0
        /// <summary>
        /// Pushes a page to Navigator.
        /// If the page is already in Navigator, then it is not pushed.
        /// </summary>
        /// <param name="page">The page to push to Navigator.</param>
        /// <exception cref="ArgumentNullException">Thrown when the argument page is null.</exception>
        /// <since_tizen> 9 </since_tizen>
        public void Push(Page page)
        {
            if (!transitionFinished)
            {
                Tizen.Log.Error("NUI", "Transition is still not finished.\n");
                return;
            }

            if (page == null)
            {
                throw new ArgumentNullException(nameof(page), "page should not be null.");
            }

            //Duplicate page is not pushed.
            if (navigationPages.Contains(page))
            {
                return;
            }

            var curTop = Peek();

            if (!curTop)
            {
                Insert(0, page);
                return;
            }

            navigationPages.Add(page);
            Add(page);
            page.Navigator = this;

            //Invoke Page events
            page.InvokeAppearing();
            curTop.InvokeDisappearing();

            //TODO: The following transition codes will be replaced with view transition.
            if (curAnimation)
            {
                curAnimation.Stop();
                curAnimation.Clear();
            }

            if (newAnimation)
            {
                newAnimation.Stop();
                newAnimation.Clear();
            }

            if (page is DialogPage == false)
            {
                curAnimation = new Animation(1000);
                curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
                curAnimation.EndAction = Animation.EndActions.Discard;
                curAnimation.Play();

                using (var opacityProp = new Tizen.NUI.PropertyValue(0.0f))
                {
                    Tizen.NUI.Object.SetProperty(page.SwigCPtr, Page.Property.OPACITY, opacityProp);
                }
                newAnimation = new Animation(1000);
                newAnimation.AnimateTo(page, "Opacity", 1.0f, 0, 1000);
                newAnimation.Play();
            }
        }