示例#1
0
        protected override void Draw(ref Parameters.UiViewDrawParameters parameters)
        {
            float opacity = parameters.Opacity;

            if (opacity == 0)
            {
                return;
            }

            DrawBackground(ref parameters);

            if (_clipChildren)
            {
                parameters.DrawBatch.PushClip(ScreenBounds);
            }

            for (int idx = 0; idx < _children.Count; ++idx)
            {
                UiPage page = _children[idx] as UiPage;
                page.ViewDraw(ref parameters);
            }

            if (_clipChildren)
            {
                parameters.DrawBatch.PopClip();
            }
        }
示例#2
0
        private void AddPage(UiPage page)
        {
            UiPage lastVisibleChild = null;

            for (int idx = 0; idx < _children.Count; ++idx)
            {
                var child = _children[idx] as UiPage;
                child.Hide();
                lastVisibleChild = child;

                if (child.HideTransitionEffect == null)
                {
                    child.HideTransitionEffect = (page != null && page.ShowTransitionEffect != null) ? page.ShowTransitionEffect.Reverse() : null;
                    child.HideSpeed            = page != null ? page.ShowSpeed : float.MaxValue;

                    if (child.HideTransitionEffect == null)
                    {
                        child.HideTransitionEffect = child.ShowTransitionEffect != null?child.ShowTransitionEffect.Reverse() : null;

                        child.HideSpeed = child.ShowSpeed;
                    }
                }
            }

            if (page != null)
            {
                _children.Add(page);
                page.Bounds = CalculateChildBounds(page);
                page.Parent = this;

                page.RegisterView();
                page.ViewAdded();

                if (page.ShowTransitionEffect == null)
                {
                    page.ShowTransitionEffect = (lastVisibleChild != null && lastVisibleChild.HideTransitionEffect != null) ? lastVisibleChild.HideTransitionEffect.Reverse() : null;
                    page.ShowSpeed            = lastVisibleChild != null ? lastVisibleChild.HideSpeed : float.MaxValue;
                }

                if (OnPageAdded != null)
                {
                    OnPageAdded(page);
                }

                _skipUpdate = true;
            }
        }
示例#3
0
        protected override bool Init(object controller, object binding, DefinitionFile definition)
        {
            if (!base.Init(controller, binding, definition))
            {
                return(false);
            }

            DefinitionFileWithStyle file = new DefinitionFileWithStyle(definition, typeof(UiNavigationView));

            string url = DefinitionResolver.GetString(Controller, binding, file["Page"]);

            if (!string.IsNullOrWhiteSpace(url))
            {
                DefinitionFile pageFile = ContentLoader.Current.Load <DefinitionFile>(url);

                NavigateTo(pageFile, new InvokeParameters());
                UiPage page = _children[0] as UiPage;
                page.InstantShow();
            }

            return(true);
        }