Exemple #1
0
        public void Add(DeXignPage page)
        {
            if (!pageChildNames.ContainsKey(page))
            {
                pageChildNames[page] = new List <string>();
            }

            // Clear
            pageChildNames[page].Clear();
            elementBackpack[GetCleanName(page.Name)] = page;

            foreach (FrameworkElement element in page.FindVisualChildrens <FrameworkElement>())
            {
                string name = element.Name;

                if (name.StartsWith("__") && name.EndsWith("__"))
                {
                    name = GetCleanName(name);

                    if (elementBackpack.ContainsKey(name))
                    {
                        throw new ElementNameDuplicateException();
                    }

                    // Add On Global Backpack
                    elementBackpack[name] = element;

                    // Add On Page Child Names
                    if (page.Name != element.Name)
                    {
                        pageChildNames[page].Add(name);
                    }
                }
            }
        }
Exemple #2
0
        public void SetPage(DeXignPage page)
        {
            if (this.SelectedPage == page)
            {
                return;
            }

            if (elementBackpack.ContainsValue(page))
            {
                if (SelectedPage == null)
                {
                    // Initialize
                    if (IsAndroidStyle)
                    {
                        this.Width  = page.Width + 36;
                        this.Height = page.Height + 178;
                    }
                    else
                    {
                        this.Width  = page.Width + SystemParameters.ResizeFrameVerticalBorderWidth * 2;
                        this.Height = page.Height + SystemParameters.ResizeFrameHorizontalBorderHeight * 2 + SystemParameters.CaptionHeight;
                    }
                }

                page.Width               = double.NaN;
                page.Height              = double.NaN;
                page.VerticalAlignment   = VerticalAlignment.Stretch;
                page.HorizontalAlignment = HorizontalAlignment.Stretch;

                BindingHelper.SetBinding(
                    page, DeXignPage.WindowTitleProperty,
                    this, Window.TitleProperty,
                    BindingMode.OneWay);

                if (SelectedPage != null)
                {
                    FadeTransition(this.SelectedPage, page);
                }
                else
                {
                    pagePresenter.Content = page;
                }
            }
            else
            {
                throw new UnknownPageException();
            }
        }
Exemple #3
0
        private void FadeTransition(DeXignPage selectedPage, DeXignPage page)
        {
            page.Opacity = 0;

            pagePresenter.Content           = page;
            pageTransitionPresenter.Content = selectedPage;

            // stop animation
            if (transitionStoryboard != null)
            {
                transitionStoryboard.Stop();
            }

            var easing = new PowerEase()
            {
                EasingMode = EasingMode.EaseOut
            };

            var fadeOut = new DoubleAnimation(0, 1, new Duration(TimeSpan.FromMilliseconds(350)))
            {
                EasingFunction = easing
            };

            var fadeIn = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromMilliseconds(350)))
            {
                EasingFunction = easing
            };

            Storyboard.SetTarget(fadeOut, page);
            Storyboard.SetTargetProperty(fadeOut, new PropertyPath("Opacity"));

            Storyboard.SetTarget(fadeIn, selectedPage);
            Storyboard.SetTargetProperty(fadeIn, new PropertyPath("Opacity"));

            transitionStoryboard = new Storyboard();

            transitionStoryboard.Children.Add(fadeOut);
            transitionStoryboard.Children.Add(fadeIn);

            transitionStoryboard.Begin();
        }
Exemple #4
0
        public void Remove(DeXignPage page)
        {
            // 페이지 제거 (Global)
            if (elementBackpack.ContainsKey(page.Name))
            {
                elementBackpack.Remove(page.Name);
            }

            if (pageChildNames.ContainsKey(page))
            {
                // 페이지 자식 이름 제거
                foreach (string childName in pageChildNames[page])
                {
                    if (elementBackpack.ContainsKey(childName))
                    {
                        elementBackpack.Remove(childName);
                    }
                }

                // 페이지 제거
                pageChildNames.Remove(page);
            }
        }
Exemple #5
0
        public void SetPage(DeXignPage page)
        {
            if (elementBackpack.ContainsValue(page))
            {
                if (SelectedPage == null)
                {
                    // Initialize
                    this.Width  = page.Width + SystemParameters.ResizeFrameVerticalBorderWidth * 2;
                    this.Height = page.Height + SystemParameters.ResizeFrameHorizontalBorderHeight * 2 + SystemParameters.CaptionHeight;

                    page.Width  = double.NaN;
                    page.Height = double.NaN;
                }

                pagePresenter.Content = page;

                this.Title = page.WindowTitle ?? "";
            }
            else
            {
                throw new UnknownPageException();
            }
        }